Skip to content

Commit be93e48

Browse files
authored
Hide collapse icon in diff with no lines (#21094)
Sometimes (e.g. renaming a file) nothing of the content is changed. In this case, it makes no sense to show the collapse icon in a diff.
1 parent 85016af commit be93e48

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

templates/repo/diff/box.tmpl

+9-7
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@
7979
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if $file.ShouldBeHidden}}data-folded="true"{{end}}>
8080
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
8181
<div class="df ac">
82-
<a role="button" class="fold-file muted mr-2">
83-
{{if $file.ShouldBeHidden}}
84-
{{svg "octicon-chevron-right" 18}}
85-
{{else}}
86-
{{svg "octicon-chevron-down" 18}}
87-
{{end}}
88-
</a>
82+
{{if or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
83+
<a role="button" class="fold-file muted mr-2">
84+
{{if $file.ShouldBeHidden}}
85+
{{svg "octicon-chevron-right" 18}}
86+
{{else}}
87+
{{svg "octicon-chevron-down" 18}}
88+
{{end}}
89+
</a>
90+
{{end}}
8991
<div class="bold df ac">
9092
{{if $file.IsBin}}
9193
<span class="ml-1 mr-3">

0 commit comments

Comments
 (0)