@@ -229,7 +229,7 @@
{{end}}
{{$showDiffBox = true}}
{{end}}
- {{else}}
+ {{else if not .IsNothingToCompare}}
{{$showDiffBox = true}}
{{end}}
From 7f93d789393aa14cda09e37b3cec52a3d7ce543a Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Mon, 28 Aug 2023 05:03:46 +0000
Subject: [PATCH 3/4] add comment
---
options/locale/locale_en-US.ini | 1 +
templates/repo/diff/compare.tmpl | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 31d47ad6af202..1ef36030d93d8 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1692,6 +1692,7 @@ pulls.select_commit_hold_shift_for_range = Select commit. Hold shift + click to
pulls.review_only_possible_for_full_diff = Review is only possible when viewing the full diff
pulls.filter_changes_by_commit = Filter by commit
pulls.nothing_to_compare = These branches are equal. There is no need to create a pull request.
+pulls.nothing_to_compare_bewtween_branch_and_tag = The selected branch and tag are equal.
pulls.nothing_to_compare_and_allow_empty_pr = These branches are equal. This PR will be empty.
pulls.has_pull_request = `A pull request between these branches already exists: %[2]s#%[3]d`
pulls.create = Create Pull Request
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index a63d4801d194f..a815f9516831e 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -176,8 +176,8 @@
- {{if and .PageIsComparePull .IsNothingToCompare}}
- {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
+ {{if .IsNothingToCompare}}
+ {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) .PageIsComparePull}}
{{end}}
{{else if and .PageIsComparePull (gt .CommitCount 0)}}
{{if .HasPullRequest}}
From 689b136442f6bb609c77a1ca2d8e0e05f87b97ff Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Mon, 28 Aug 2023 05:16:26 +0000
Subject: [PATCH 4/4] improve
---
options/locale/locale_en-US.ini | 2 +-
templates/repo/diff/compare.tmpl | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 1ef36030d93d8..d46ce7f54ec15 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1692,7 +1692,7 @@ pulls.select_commit_hold_shift_for_range = Select commit. Hold shift + click to
pulls.review_only_possible_for_full_diff = Review is only possible when viewing the full diff
pulls.filter_changes_by_commit = Filter by commit
pulls.nothing_to_compare = These branches are equal. There is no need to create a pull request.
-pulls.nothing_to_compare_bewtween_branch_and_tag = The selected branch and tag are equal.
+pulls.nothing_to_compare_have_tag = The selected branch/tag are equal.
pulls.nothing_to_compare_and_allow_empty_pr = These branches are equal. This PR will be empty.
pulls.has_pull_request = `A pull request between these branches already exists: %[2]s#%[3]d`
pulls.create = Create Pull Request
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index a815f9516831e..a8ac83ad86ee6 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -185,10 +185,10 @@
{{template "repo/issue/new_form" .}}
- {{else if .PageIsComparePull}}
+ {{else if and .HeadIsBranch .BaseIsBranch}}