From e2df8333a9674153d5d1ace118acd7651b545042 Mon Sep 17 00:00:00 2001 From: marty Date: Wed, 28 Jul 2021 16:53:59 +0200 Subject: [PATCH 1/3] fix --- routers/web/repo/pull.go | 4 ++++ templates/repo/commits_table.tmpl | 3 +++ 2 files changed, 7 insertions(+) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 565c645801d28..47d99220bc592 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 3ef2339843a53..4d7686900f8e7 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -2,6 +2,9 @@
{{if or .PageIsCommits (gt .CommitCount 0)}} {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}} + {{else if .IsNothingToCompare }} + {{.i18n.Tr "repo.pulls.is_empty" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} + {{else}} {{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} {{end}} From 56669179f780337a6ae450140111173196469cb2 Mon Sep 17 00:00:00 2001 From: marty Date: Wed, 28 Jul 2021 17:14:39 +0200 Subject: [PATCH 2/3] use own text --- options/locale/locale_en-US.ini | 1 + templates/repo/commits_table.tmpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 760c026116d94..96fda97dda98b 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/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 4d7686900f8e7..3022ca8d4c36f 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -3,7 +3,7 @@ {{if or .PageIsCommits (gt .CommitCount 0)}} {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}} {{else if .IsNothingToCompare }} - {{.i18n.Tr "repo.pulls.is_empty" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} + {{.i18n.Tr "repo.commits.nothing_to_compare" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} {{else}} {{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} From a05ebec9ad218f9d2b9465ec23f89803fe3ad8e5 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 28 Jul 2021 19:09:08 +0100 Subject: [PATCH 3/3] Update templates/repo/commits_table.tmpl --- templates/repo/commits_table.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 3022ca8d4c36f..7bdcb340d9fe8 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -3,7 +3,7 @@ {{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" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}} + {{.i18n.Tr "repo.commits.nothing_to_compare" }} {{if .Branch}}({{.Branch}}){{end}} {{else}} {{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}}