]> source.dussan.org Git - gitea.git/commitdiff
Show pull request selection even when unrelated branches (#11239) (#11283)
authorguillep2k <18600385+guillep2k@users.noreply.github.com>
Mon, 4 May 2020 11:38:26 +0000 (08:38 -0300)
committerGitHub <noreply@github.com>
Mon, 4 May 2020 11:38:26 +0000 (12:38 +0100)
Fix #10525

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
routers/repo/compare.go
templates/repo/diff/compare.tmpl

index 92a666891eaa1905512412cc68b41b2fa7ac0acb..cabb7365f421bc08821792241b3f6c8aa343df12 100644 (file)
@@ -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)
index 50a51c44acc2046dc7369a2547e49256ed2ec6c4..db097ee356a202462423597b37305d8e483c3ac5 100644 (file)
@@ -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}}