aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarty <58218546+PotatoesFall@users.noreply.github.com>2021-07-29 04:32:48 +0200
committerGitHub <noreply@github.com>2021-07-29 03:32:48 +0100
commit4e68d6f41d21e7c5465be6bdb6713c36eb586dfd (patch)
treeec749491e1ca2990cf3eea03bd5b711d8fedeb77
parent33e0b38287fdc3487112062300b8dd3c95415ee7 (diff)
downloadgitea-4e68d6f41d21e7c5465be6bdb6713c36eb586dfd.tar.gz
gitea-4e68d6f41d21e7c5465be6bdb6713c36eb586dfd.zip
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>
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--routers/web/repo/pull.go4
-rw-r--r--templates/repo/commits_table.tmpl3
3 files changed, 8 insertions, 0 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 760c026116..96fda97dda 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1040,6 +1040,7 @@ editor.require_signed_commit = Branch requires a signed commit
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.nothing_to_compare = These branches are equal.
commits.search = Search commits…
commits.search.tooltip = You can prefix keywords with "author:", "committer:", "after:", or "before:", e.g. "revert author:Alice before:2019-04-01".
commits.find = Search
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 15c9f14808..5c61e0d5fa 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -527,6 +527,10 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
return nil
}
+ if compareInfo.HeadCommitID == compareInfo.MergeBase {
+ ctx.Data["IsNothingToCompare"] = true
+ }
+
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
if pull.IsWorkInProgress() {
diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl
index 3ef2339843..7bdcb340d9 100644
--- a/templates/repo/commits_table.tmpl
+++ b/templates/repo/commits_table.tmpl
@@ -2,6 +2,9 @@
<div class="commits-table-left df ac">
{{if or .PageIsCommits (gt .CommitCount 0)}}
{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}}
+ {{else if .IsNothingToCompare }}
+ {{.i18n.Tr "repo.commits.nothing_to_compare" }} {{if .Branch}}({{.Branch}}){{end}}
+
{{else}}
{{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}}
{{end}}