Fixes diff on merged pull requests (#7171)

This commit is contained in:
Mario Lubenka 2019-06-12 01:32:08 +02:00 committed by techknowlogick
parent 499a8a1cdd
commit 1608f63e39
3 changed files with 13 additions and 13 deletions

View file

@ -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)