mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-23 12:52:03 +02:00
Fix bug
This commit is contained in:
parent
f717d4f2e5
commit
c566b49e02
@ -448,7 +448,8 @@ func PrepareCompareDiff(
|
|||||||
|
|
||||||
if (headCommitID == ci.MergeBase && !ci.DirectComparison()) ||
|
if (headCommitID == ci.MergeBase && !ci.DirectComparison()) ||
|
||||||
headCommitID == ci.BaseCommitID {
|
headCommitID == ci.BaseCommitID {
|
||||||
ctx.Data["IsNothingToCompare"] = true
|
ctx.Data["CommitCount"] = 0
|
||||||
|
ctx.Data["DiffNotAvailable"] = true
|
||||||
if unit, err := repo.GetUnit(ctx, unit.TypePullRequests); err == nil {
|
if unit, err := repo.GetUnit(ctx, unit.TypePullRequests); err == nil {
|
||||||
config := unit.PullRequestsConfig()
|
config := unit.PullRequestsConfig()
|
||||||
|
|
||||||
@ -495,7 +496,6 @@ func PrepareCompareDiff(
|
|||||||
ctx.ServerError("GetDiffShortStat", err)
|
ctx.ServerError("GetDiffShortStat", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ctx.Data["IsNothingToCompare"] = diffShortStat.NumFiles == 0
|
|
||||||
ctx.Data["DiffShortStat"] = diffShortStat
|
ctx.Data["DiffShortStat"] = diffShortStat
|
||||||
ctx.Data["Diff"] = diff
|
ctx.Data["Diff"] = diff
|
||||||
ctx.Data["DiffBlobExcerptData"] = &gitdiff.DiffBlobExcerptData{
|
ctx.Data["DiffBlobExcerptData"] = &gitdiff.DiffBlobExcerptData{
|
||||||
|
|||||||
@ -174,8 +174,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if and .IsSigned .PageIsComparePull}}
|
{{if and .IsSigned .PageIsComparePull}}
|
||||||
{{$allowCreatePR := and ($.CompareInfo.BaseRef.IsBranch) ($.CompareInfo.HeadRef.IsBranch) (not $.CompareInfo.DirectComparison) (or $.AllowEmptyPr (not .IsNothingToCompare))}}
|
{{$allowCreatePR := and ($.CompareInfo.BaseRef.IsBranch) ($.CompareInfo.HeadRef.IsBranch) (not $.CompareInfo.DirectComparison) (or $.AllowEmptyPr (not .DiffNotAvailable))}}
|
||||||
{{if .IsNothingToCompare}}
|
{{if .DiffNotAvailable}}
|
||||||
<div class="ui segment">
|
<div class="ui segment">
|
||||||
{{if $allowCreatePR}}
|
{{if $allowCreatePR}}
|
||||||
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
|
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
|
||||||
@ -215,18 +215,20 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}{{/* not singed-in or not for pull-request */}}
|
{{else}}{{/* not singed-in or not for pull-request */}}
|
||||||
{{if .IsNothingToCompare}}
|
{{if .DiffNotAvailable}}
|
||||||
<div class="ui segment">{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}</div>
|
<div class="ui segment">{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if not .IsNothingToCompare}}
|
{{if or .CommitCount (not .DiffNotAvailable)}}
|
||||||
<div class="ui container fluid padded tw-my-4">
|
<div class="ui container fluid padded tw-my-4">
|
||||||
{{if .CommitCount}}
|
{{if .CommitCount}}
|
||||||
{{template "repo/commits_table" .}}
|
{{template "repo/commits_table" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{template "repo/diff/box" .}}
|
{{if not .DiffNotAvailable}}
|
||||||
|
{{template "repo/diff/box" .}}
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user