Skip to content

Commit 16e3402

Browse files
zeripath6543
andauthored
Show diff on rename with diff changes (#15338) (#15339)
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>
1 parent 456d63b commit 16e3402

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

templates/repo/diff/box.tmpl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
{{svg "octicon-chevron-down" 18}}
5050
</a>
5151
<div class="bold ui left df ac">
52-
{{if not $file.IsRenamed}}
53-
{{template "repo/diff/stats" dict "file" . "root" $}}
54-
{{end}}
52+
{{template "repo/diff/stats" dict "file" . "root" $}}
5553
</div>
5654
<span class="file mono">{{$file.Name}}</span>
5755
<div class="diff-file-header-actions df ac">
@@ -85,7 +83,7 @@
8583
<div class="bold df ac">
8684
{{if $file.IsBin}}
8785
{{$.i18n.Tr "repo.diff.bin"}}
88-
{{else if not $file.IsRenamed}}
86+
{{else}}
8987
{{template "repo/diff/stats" dict "file" . "root" $}}
9088
{{end}}
9189
</div>
@@ -105,23 +103,21 @@
105103
</div>
106104
</h4>
107105
<div class="diff-file-body ui attached unstackable table segment">
108-
{{if ne $file.Type 4}}
109-
<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}}">
110-
<table class="chroma{{if $isImage}} w-100{{end}}">
111-
<tbody>
112-
{{if $isImage}}
113-
{{template "repo/diff/image_diff" dict "file" . "root" $}}
106+
<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}}">
107+
<table class="chroma{{if $isImage}} w-100{{end}}">
108+
<tbody>
109+
{{if $isImage}}
110+
{{template "repo/diff/image_diff" dict "file" . "root" $}}
111+
{{else}}
112+
{{if $.IsSplitStyle}}
113+
{{template "repo/diff/section_split" dict "file" . "root" $}}
114114
{{else}}
115-
{{if $.IsSplitStyle}}
116-
{{template "repo/diff/section_split" dict "file" . "root" $}}
117-
{{else}}
118-
{{template "repo/diff/section_unified" dict "file" . "root" $}}
119-
{{end}}
115+
{{template "repo/diff/section_unified" dict "file" . "root" $}}
120116
{{end}}
121-
</tbody>
122-
</table>
123-
</div>
124-
{{end}}
117+
{{end}}
118+
</tbody>
119+
</table>
120+
</div>
125121
</div>
126122
</div>
127123
{{end}}

0 commit comments

Comments
 (0)