Skip to content

Commit

Permalink
Show diff on rename with diff changes (#15338)
Browse files Browse the repository at this point in the history
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 <[email protected]>

Co-authored-by: 6543 <[email protected]>
  • Loading branch information
zeripath and 6543 authored Apr 8, 2021
1 parent b62bd8e commit f544414
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
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 @@ -87,7 +85,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 @@ -113,21 +111,20 @@
</div>
</h4>
<div class="diff-file-body ui attached unstackable table segment">
{{if ne $file.Type 4}}
<div id="diff-source-{{$i}}" class="file-body file-code has-context-menu code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}">
{{if $file.IsBin}}
<div id="diff-source-{{$i}}" class="file-body file-code has-context-menu code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}">
{{if $file.IsBin}}
<div class="diff-file-body binary" style="padding: 5px 10px;">{{$.i18n.Tr "repo.diff.bin_not_shown"}}</div>
{{else}}
{{else}}
<table class="chroma">
{{if $.IsSplitStyle}}
{{template "repo/diff/section_split" dict "file" . "root" $}}
{{else}}
{{template "repo/diff/section_unified" dict "file" . "root" $}}
{{end}}
</table>
{{end}}
</div>
{{if or $isImage $isCsv}}
{{end}}
</div>
{{if or $isImage $isCsv}}
<div id="diff-rendered-{{$i}}" class="file-body file-code has-context-menu{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}} hide">
<table class="chroma w-100">
{{if $isImage}}
Expand All @@ -137,7 +134,6 @@
{{end}}
</table>
</div>
{{end}}
{{end}}
</div>
</div>
Expand Down

0 comments on commit f544414

Please sign in to comment.