diff options
Diffstat (limited to 'modules/git/repo_compare.go')
-rw-r--r-- | modules/git/repo_compare.go | 8 |
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) |