Skip to content

Commit f544414

Browse files
zeripath6543
andauthored
Show diff on rename with diff changes (#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 b62bd8e commit f544414

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

templates/repo/diff/box.tmpl

+8-12
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">
@@ -87,7 +85,7 @@
8785
<div class="bold df ac">
8886
{{if $file.IsBin}}
8987
{{$.i18n.Tr "repo.diff.bin"}}
90-
{{else if not $file.IsRenamed}}
88+
{{else}}
9189
{{template "repo/diff/stats" dict "file" . "root" $}}
9290
{{end}}
9391
</div>
@@ -113,21 +111,20 @@
113111
</div>
114112
</h4>
115113
<div class="diff-file-body ui attached unstackable table segment">
116-
{{if ne $file.Type 4}}
117-
<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}}">
118-
{{if $file.IsBin}}
114+
<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}}">
115+
{{if $file.IsBin}}
119116
<div class="diff-file-body binary" style="padding: 5px 10px;">{{$.i18n.Tr "repo.diff.bin_not_shown"}}</div>
120-
{{else}}
117+
{{else}}
121118
<table class="chroma">
122119
{{if $.IsSplitStyle}}
123120
{{template "repo/diff/section_split" dict "file" . "root" $}}
124121
{{else}}
125122
{{template "repo/diff/section_unified" dict "file" . "root" $}}
126123
{{end}}
127124
</table>
128-
{{end}}
129-
</div>
130-
{{if or $isImage $isCsv}}
125+
{{end}}
126+
</div>
127+
{{if or $isImage $isCsv}}
131128
<div id="diff-rendered-{{$i}}" class="file-body file-code has-context-menu{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}} hide">
132129
<table class="chroma w-100">
133130
{{if $isImage}}
@@ -137,7 +134,6 @@
137134
{{end}}
138135
</table>
139136
</div>
140-
{{end}}
141137
{{end}}
142138
</div>
143139
</div>

0 commit comments

Comments
 (0)