From c6ce6bd4c2e51d2282b5810d49683d34113cf0c7 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 23 Oct 2015 10:31:13 -0400 Subject: [PATCH] work on #1830 --- gogs.go | 2 +- models/update.go | 4 ++-- modules/git/repo_commit.go | 9 ++++----- routers/repo/issue.go | 2 +- templates/.VERSION | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gogs.go b/gogs.go index dc1cc000b5..60a5b24899 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.6.16.1022 Beta" +const APP_VER = "0.6.16.1023 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/update.go b/models/update.go index cbaf0e6618..645b58c4c5 100644 --- a/models/update.go +++ b/models/update.go @@ -117,12 +117,12 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName if isNew { l, err = newCommit.CommitsBefore() if err != nil { - return fmt.Errorf("Find CommitsBefore erro: %v", err) + return fmt.Errorf("CommitsBefore: %v", err) } } else { l, err = newCommit.CommitsBeforeUntil(oldCommitId) if err != nil { - return fmt.Errorf("Find CommitsBeforeUntil erro: %v", err) + return fmt.Errorf("CommitsBeforeUntil: %v", err) } } diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index cb9fa8d459..e8ac2dfc57 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -111,9 +111,9 @@ func (repo *Repository) getCommit(id sha1) (*Commit, error) { repo.commitCache = make(map[sha1]*Commit, 10) } - data, bytErr, err := com.ExecCmdDirBytes(repo.Path, "git", "cat-file", "-p", id.String()) + data, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "cat-file", "-p", id.String()) if err != nil { - return nil, errors.New(err.Error() + ": " + string(bytErr)) + return nil, concatenateError(err, string(stderr)) } commit, err := parseCommitData(data) @@ -229,7 +229,7 @@ func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List func (repo *Repository) commitsBefore(lock *sync.Mutex, l *list.List, parent *list.Element, id sha1, limit int) error { commit, err := repo.getCommit(id) if err != nil { - return err + return fmt.Errorf("getCommit: %v", err) } var e *list.Element @@ -301,8 +301,7 @@ func (repo *Repository) CommitsByFileAndRange(branch, file string, page int) (*l func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) { l := list.New() lock := new(sync.Mutex) - err := repo.commitsBefore(lock, l, nil, id, 0) - return l, err + return l, repo.commitsBefore(lock, l, nil, id, 0) } func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) { diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 5bc53b35f8..e49b572c26 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -768,7 +768,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) { var pr *models.PullRequest - if form.Status == "reopen" { + if form.Status == "reopen" && issue.IsPull { pull := issue.PullRequest pr, err = models.GetUnmergedPullRequest(pull.HeadRepoID, pull.BaseRepoID, pull.HeadBranch, pull.BaseBranch) if err != nil { diff --git a/templates/.VERSION b/templates/.VERSION index c7f062e51b..f179151c0f 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.6.16.1022 Beta \ No newline at end of file +0.6.16.1023 Beta \ No newline at end of file