Skip to content

Commit cf9b9d3

Browse files
committed
7184- message if line too long
1 parent 6ea6e2b commit cf9b9d3

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,7 @@ diff.file_image_width = Width
18861886
diff.file_image_height = Height
18871887
diff.file_byte_size = Size
18881888
diff.file_suppressed = File diff suppressed because it is too large
1889+
diff.file_suppressed_line_too_long = File diff suppressed because at least one line is too long
18891890
diff.too_many_files = Some files were not shown because too many files changed in this diff
18901891
diff.comment.placeholder = Leave a comment
18911892
diff.comment.markdown_info = Styling with markdown is supported.

services/gitdiff/gitdiff.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -574,21 +574,22 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem
574574

575575
// DiffFile represents a file diff.
576576
type DiffFile struct {
577-
Name string
578-
OldName string
579-
Index int
580-
Addition, Deletion int
581-
Type DiffFileType
582-
IsCreated bool
583-
IsDeleted bool
584-
IsBin bool
585-
IsLFSFile bool
586-
IsRenamed bool
587-
IsAmbiguous bool
588-
IsSubmodule bool
589-
Sections []*DiffSection
590-
IsIncomplete bool
591-
IsProtected bool
577+
Name string
578+
OldName string
579+
Index int
580+
Addition, Deletion int
581+
Type DiffFileType
582+
IsCreated bool
583+
IsDeleted bool
584+
IsBin bool
585+
IsLFSFile bool
586+
IsRenamed bool
587+
IsAmbiguous bool
588+
IsSubmodule bool
589+
Sections []*DiffSection
590+
IsIncomplete bool
591+
IsIncompleteLineTooLong bool
592+
IsProtected bool
592593
}
593594

594595
// GetType returns type of diff file.
@@ -1073,6 +1074,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio
10731074
}
10741075
if len(line) > maxLineCharacters {
10751076
curFile.IsIncomplete = true
1077+
curFile.IsIncompleteLineTooLong = true
10761078
line = line[:maxLineCharacters]
10771079
}
10781080
curSection.Lines[len(curSection.Lines)-1].Content = line

templates/repo/diff/box.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@
5353
</div>
5454
<span class="file mono">{{$file.Name}}</span>
5555
<div class="diff-file-header-actions df ac">
56-
<div class="text grey">{{$.i18n.Tr "repo.diff.file_suppressed"}}</div>
56+
<div class="text grey">
57+
{{if $file.IsIncompleteLineTooLong}}
58+
{{$.i18n.Tr "repo.diff.file_suppressed_line_too_long"}}
59+
{{else}}
60+
{{$.i18n.Tr "repo.diff.file_suppressed"}}
61+
{{end}}
62+
</div>
5763
{{if $file.IsProtected}}
5864
<span class="ui basic label">{{$.i18n.Tr "repo.diff.protected"}}</span>
5965
{{end}}

0 commit comments

Comments
 (0)