summaryrefslogtreecommitdiffstats
path: root/modules/git/repo_compare.go
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-06-12 01:32:08 +0200
committertechknowlogick <hello@techknowlogick.com>2019-06-11 19:32:08 -0400
commit1608f63e396c78bcbea3605b812556ddf441a6c4 (patch)
treeea9fd908eefc3acafce94d79625243b4999258dc /modules/git/repo_compare.go
parent499a8a1cdd815cc25554371598140f5fb01e216f (diff)
downloadgitea-1608f63e396c78bcbea3605b812556ddf441a6c4.tar.gz
gitea-1608f63e396c78bcbea3605b812556ddf441a6c4.zip
Fixes diff on merged pull requests (#7171)
Diffstat (limited to 'modules/git/repo_compare.go')
-rw-r--r--modules/git/repo_compare.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index e7a1d72a85..42f0b9ad0c 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -22,8 +22,8 @@ type CompareInfo struct {
NumFiles int
}
-// GetMergeBase checks and returns merge base of two branches.
-func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (string, error) {
+// GetMergeBase checks and returns merge base of two branches and the reference used as base.
+func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (string, string, error) {
if tmpRemote == "" {
tmpRemote = "origin"
}
@@ -38,7 +38,7 @@ func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (strin
}
stdout, err := NewCommand("merge-base", base, head).RunInDir(repo.Path)
- return strings.TrimSpace(stdout), err
+ return strings.TrimSpace(stdout), base, err
}
// GetCompareInfo generates and returns compare information between base and head branches of repositories.
@@ -59,7 +59,7 @@ func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string)
}
compareInfo := new(CompareInfo)
- compareInfo.MergeBase, err = repo.GetMergeBase(tmpRemote, baseBranch, headBranch)
+ compareInfo.MergeBase, remoteBranch, err = repo.GetMergeBase(tmpRemote, baseBranch, headBranch)
if err == nil {
// We have a common base
logs, err := NewCommand("log", compareInfo.MergeBase+"..."+headBranch, prettyLogFormat).RunInDirBytes(repo.Path)