aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}}