feat(ui): add "follow rename" to file commit history list (#34994)

Fix #28253

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Thomas Sayen
2026-06-03 19:40:38 +02:00
committed by GitHub
parent 735e940a61
commit b2748d7654
17 changed files with 169 additions and 82 deletions
+18 -9
View File
@@ -1,21 +1,30 @@
<h4 class="ui top attached header commits-table flex-left-right">
<div class="commits-table-left flex-text-block">
{{if or .PageIsCommits (gt .CommitCount 0)}}
{{.CommitCount}} {{ctx.Locale.Tr "repo.commits.commits"}}
<div class="ui top attached header flex-left-right">
<div class="flex-text-block">
{{if .Commits}}
{{if gt .CommitCount 0}}{{.CommitCount}}{{end}}{{/* CommitCount is -1 when "follow rename" */}}
{{ctx.Locale.Tr "repo.commits.commits"}}
{{else if .IsNothingToCompare}}
{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}
{{else}}
{{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}}
{{end}}
</div>
{{if .IsDiffCompare}}
<div class="commits-table-right tw-whitespace-nowrap">
<div class="flex-text-block">
{{if .ShowFollowRename}}
<div class="ui checkbox">
<input type="checkbox" {{if .FollowRenameChecked}}checked{{end}} data-global-init="initCommitHistoryFollowRename">
<label>{{ctx.Locale.Tr "repo.commits.history_enable_follow_renames"}}</label>
</div>
{{end}}
{{if .IsDiffCompare}}
<div class="flex-text-inline">
<a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID | PathEscape}}" class="ui green sha label tw-mx-0">{{template "repo/commits_ref_name" .CompareInfo.BaseRef}}</a>
{{$.CompareInfo.CompareSeparator}}
<a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID | PathEscape}}" class="ui green sha label tw-mx-0">{{template "repo/commits_ref_name" .CompareInfo.HeadRef}}</a>
</div>
{{end}}
</h4>
{{end}}
</div>
</div>
{{if .PageIsCommits}}
<div class="ui attached segment">
@@ -29,7 +38,7 @@
</div>
{{end}}
{{if and .Commits (gt .CommitCount 0)}}
{{if .Commits}}
{{template "repo/commits_list" .}}
{{end}}