Skip to content

Commit

Permalink
Show diff on rename with diff changes (#15338) (#15339)
Browse files Browse the repository at this point in the history
Backport #15338

More recent versions of git have increased support for detection of renames meaning
that a rename with diff changes is now supported.

Although ParsePatch supports this - our templates do not and the simplest solution
is simply to show the diff.

Fix #15335

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: 6543 <6543@obermui.de>
  • Loading branch information
zeripath and 6543 committed Apr 8, 2021
1 parent 456d63b commit 16e3402
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions templates/repo/diff/box.tmpl
Expand Up @@ -49,9 +49,7 @@
{{svg "octicon-chevron-down" 18}}
</a>
<div class="bold ui left df ac">
{{if not $file.IsRenamed}}
{{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
{{template "repo/diff/stats" dict "file" . "root" $}}
</div>
<span class="file mono">{{$file.Name}}</span>
<div class="diff-file-header-actions df ac">
Expand Down Expand Up @@ -85,7 +83,7 @@
<div class="bold df ac">
{{if $file.IsBin}}
{{$.i18n.Tr "repo.diff.bin"}}
{{else if not $file.IsRenamed}}
{{else}}
{{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
</div>
Expand All @@ -105,23 +103,21 @@
</div>
</h4>
<div class="diff-file-body ui attached unstackable table segment">
{{if ne $file.Type 4}}
<div class="file-body file-code has-context-menu{{if not $isImage}} code-diff{{end}}{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $isImage}} py-4{{end}}">
<table class="chroma{{if $isImage}} w-100{{end}}">
<tbody>
{{if $isImage}}
{{template "repo/diff/image_diff" dict "file" . "root" $}}
<div class="file-body file-code has-context-menu{{if not $isImage}} code-diff{{end}}{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $isImage}} py-4{{end}}">
<table class="chroma{{if $isImage}} w-100{{end}}">
<tbody>
{{if $isImage}}
{{template "repo/diff/image_diff" dict "file" . "root" $}}
{{else}}
{{if $.IsSplitStyle}}
{{template "repo/diff/section_split" dict "file" . "root" $}}
{{else}}
{{if $.IsSplitStyle}}
{{template "repo/diff/section_split" dict "file" . "root" $}}
{{else}}
{{template "repo/diff/section_unified" dict "file" . "root" $}}
{{end}}
{{template "repo/diff/section_unified" dict "file" . "root" $}}
{{end}}
</tbody>
</table>
</div>
{{end}}
{{end}}
</tbody>
</table>
</div>
</div>
</div>
{{end}}
Expand Down

0 comments on commit 16e3402

Please sign in to comment.