Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ func PrepareCompareDiff(
ctx.ServerError("GetDiffShortStat", err)
return false
}
ctx.Data["IsNothingToCompare"] = diffShortStat.NumFiles == 0
ctx.Data["DiffShortStat"] = diffShortStat
ctx.Data["Diff"] = diff
ctx.Data["DiffBlobExcerptData"] = &gitdiff.DiffBlobExcerptData{
Expand Down
9 changes: 5 additions & 4 deletions templates/repo/diff/compare.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
</div>
</div>

{{$showDiffBox := and .CommitCount (not .IsNothingToCompare)}}
{{if and .IsSigned .PageIsComparePull}}
{{$allowCreatePR := and ($.CompareInfo.BaseRef.IsBranch) ($.CompareInfo.HeadRef.IsBranch) (not $.CompareInfo.DirectComparison) (or $.AllowEmptyPr (not .IsNothingToCompare))}}
{{if .IsNothingToCompare}}
Expand Down Expand Up @@ -216,15 +215,17 @@
</div>
{{end}}
{{else}}{{/* not singed-in or not for pull-request */}}
{{if not .CommitCount}}
{{if .IsNothingToCompare}}
<div class="ui segment">{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}</div>
{{end}}
{{end}}
</div>

{{if $showDiffBox}}
{{if not .IsNothingToCompare}}
<div class="ui container fluid padded tw-my-4">
{{template "repo/commits_table" .}}
{{if .CommitCount}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{template "repo/commits_table" .}}
{{end}}
{{template "repo/diff/box" .}}
</div>
{{end}}
Expand Down