summaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-06-21 21:06:57 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-06-22 09:06:57 +0800
commit902a749fd9091721db5796805ecef56c855ebbf9 (patch)
treecedea5d6ab6555137046578e191fcd1e4272ac5a /models/pull.go
parent826c606952b7be619edb65d7861eca706b8c0eb3 (diff)
downloadgitea-902a749fd9091721db5796805ecef56c855ebbf9.tar.gz
gitea-902a749fd9091721db5796805ecef56c855ebbf9.zip
Fix fast-forward PR bug (#1989)
Diffstat (limited to 'models/pull.go')
-rw-r--r--models/pull.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/pull.go b/models/pull.go
index 882ee1b220..94bd7930ff 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -515,11 +515,11 @@ func (pr *PullRequest) getMergeCommit() (*git.Commit, error) {
mergeCommit, stderr, err := process.GetManager().ExecDirEnv(-1, "", fmt.Sprintf("isMerged (git rev-list --ancestry-path --merges --reverse): %d", pr.BaseRepo.ID),
[]string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()},
"git", "rev-list", "--ancestry-path", "--merges", "--reverse", cmd)
- if err == nil && len(mergeCommit) != 40 {
- err = fmt.Errorf("unexpected length of output (got:%d bytes) '%s'", len(mergeCommit), mergeCommit)
- }
if err != nil {
return nil, fmt.Errorf("git rev-list --ancestry-path --merges --reverse: %v %v", stderr, err)
+ } else if len(mergeCommit) < 40 {
+ // PR was fast-forwarded, so just use last commit of PR
+ mergeCommit = commitID[:40]
}
gitRepo, err := git.OpenRepository(pr.BaseRepo.RepoPath())