Skip to content

Commit 4e68d6f

Browse files
PotatoesFallmartyzeripath
authored
Show correct text when comparing commits on empty pull request (#16569)
* fix * use own text * Update templates/repo/commits_table.tmpl Co-authored-by: marty <m.karkossa@ultraware.nl> Co-authored-by: zeripath <art27@cantab.net>
1 parent 33e0b38 commit 4e68d6f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ editor.require_signed_commit = Branch requires a signed commit
10401040
commits.desc = Browse source code change history.
10411041
commits.commits = Commits
10421042
commits.no_commits = No commits in common. '%s' and '%s' have entirely different histories.
1043+
commits.nothing_to_compare = These branches are equal.
10431044
commits.search = Search commits…
10441045
commits.search.tooltip = You can prefix keywords with "author:", "committer:", "after:", or "before:", e.g. "revert author:Alice before:2019-04-01".
10451046
commits.find = Search

routers/web/repo/pull.go

+4
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
527527
return nil
528528
}
529529

530+
if compareInfo.HeadCommitID == compareInfo.MergeBase {
531+
ctx.Data["IsNothingToCompare"] = true
532+
}
533+
530534
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
531535

532536
if pull.IsWorkInProgress() {

templates/repo/commits_table.tmpl

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<div class="commits-table-left df ac">
33
{{if or .PageIsCommits (gt .CommitCount 0)}}
44
{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}}
5+
{{else if .IsNothingToCompare }}
6+
{{.i18n.Tr "repo.commits.nothing_to_compare" }} {{if .Branch}}({{.Branch}}){{end}}
7+
58
{{else}}
69
{{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}}
710
{{end}}

0 commit comments

Comments
 (0)