diff --git a/modules/git/repo_pull.go b/modules/git/repo_pull.go index c6d97a6fd16..65c54145518 100644 --- a/modules/git/repo_pull.go +++ b/modules/git/repo_pull.go @@ -48,17 +48,22 @@ func (repo *Repository) GetPullRequestInfo(basePath, baseBranch, headBranch stri prInfo := new(PullRequestInfo) prInfo.MergeBase, err = repo.GetMergeBase(remoteBranch, headBranch) - if err != nil { - return nil, fmt.Errorf("GetMergeBase: %v", err) - } - - logs, err := NewCommand("log", prInfo.MergeBase+"..."+headBranch, prettyLogFormat).RunInDirBytes(repo.Path) - if err != nil { - return nil, err - } - prInfo.Commits, err = repo.parsePrettyFormatLogToList(logs) - if err != nil { - return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err) + if err == nil { + // We have a common base + logs, err := NewCommand("log", prInfo.MergeBase+"..."+headBranch, prettyLogFormat).RunInDirBytes(repo.Path) + if err != nil { + return nil, err + } + prInfo.Commits, err = repo.parsePrettyFormatLogToList(logs) + if err != nil { + return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err) + } + } else { + prInfo.Commits = list.New() + prInfo.MergeBase, err = GetFullCommitID(repo.Path, remoteBranch) + if err != nil { + prInfo.MergeBase = remoteBranch + } } // Count number of changed files. diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index abcb89767d2..2c764f1706a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -684,6 +684,7 @@ editor.cannot_commit_to_protected_branch = Cannot commit to protected branch '%s commits.desc = Browse source code change history. commits.commits = Commits +commits.no_commits = No commits in common. '%s' and '%s' have entirely different histories. commits.search = Search commits… commits.find = Search commits.search_all = All Branches diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 53c2f98f4df..55c550ae95d 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -1,9 +1,13 @@