aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguillep2k2020-05-04 08:38:26 -0300
committerGitHub2020-05-04 12:38:26 +0100
commitff7eaa1eb4dfbe800b5768332516378bf7dfd117 (patch)
treef2d2d49ae1efebaf2ca2294e9706a87d0a4ffd44
parent5131206aadc917623be56162a8e5f7f5f2d09069 (diff)
Show pull request selection even when unrelated branches (#11239) (#11283)
Fix #10525 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
-rw-r--r--routers/repo/compare.go3
-rw-r--r--templates/repo/diff/compare.tmpl2
2 files changed, 1 insertions, 4 deletions
diff --git a/routers/repo/compare.go b/routers/repo/compare.go
index 92a666891..cabb7365f 100644
--- a/routers/repo/compare.go
+++ b/routers/repo/compare.go
@@ -320,9 +320,6 @@ func PrepareCompareDiff(
compareInfo.Commits = models.ParseCommitsWithStatus(compareInfo.Commits, headRepo)
ctx.Data["Commits"] = compareInfo.Commits
ctx.Data["CommitCount"] = compareInfo.Commits.Len()
- if ctx.Data["CommitCount"] == 0 {
- ctx.Data["PageIsComparePull"] = false
- }
if compareInfo.Commits.Len() == 1 {
c := compareInfo.Commits.Front().Value.(models.SignCommitWithStatuses)
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 50a51c44a..db097ee35 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -59,7 +59,7 @@
{{if .IsNothingToCompare}}
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare"}}</div>
- {{else if .PageIsComparePull}}
+ {{else if and .PageIsComparePull (gt .CommitCount 0)}}
{{if .HasPullRequest}}
<div class="ui segment">
{{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.Index | Safe}}