summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--services/gitdiff/gitdiff.go34
-rw-r--r--templates/repo/diff/box.tmpl8
3 files changed, 27 insertions, 16 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 69923ebb83..40e4e0c0ba 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1887,6 +1887,7 @@ diff.file_image_width = Width
diff.file_image_height = Height
diff.file_byte_size = Size
diff.file_suppressed = File diff suppressed because it is too large
+diff.file_suppressed_line_too_long = File diff suppressed because one or more lines are too long
diff.too_many_files = Some files were not shown because too many files changed in this diff
diff.comment.placeholder = Leave a comment
diff.comment.markdown_info = Styling with markdown is supported.
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index 2ca6bd957e..f8f0fd7e3b 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -574,21 +574,22 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem
// DiffFile represents a file diff.
type DiffFile struct {
- Name string
- OldName string
- Index int
- Addition, Deletion int
- Type DiffFileType
- IsCreated bool
- IsDeleted bool
- IsBin bool
- IsLFSFile bool
- IsRenamed bool
- IsAmbiguous bool
- IsSubmodule bool
- Sections []*DiffSection
- IsIncomplete bool
- IsProtected bool
+ Name string
+ OldName string
+ Index int
+ Addition, Deletion int
+ Type DiffFileType
+ IsCreated bool
+ IsDeleted bool
+ IsBin bool
+ IsLFSFile bool
+ IsRenamed bool
+ IsAmbiguous bool
+ IsSubmodule bool
+ Sections []*DiffSection
+ IsIncomplete bool
+ IsIncompleteLineTooLong bool
+ IsProtected bool
}
// GetType returns type of diff file.
@@ -935,6 +936,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio
for {
for isFragment {
curFile.IsIncomplete = true
+ curFile.IsIncompleteLineTooLong = true
_, isFragment, err = input.ReadLine()
if err != nil {
// Now by the definition of ReadLine this cannot be io.EOF
@@ -1062,6 +1064,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio
line := string(lineBytes)
if isFragment {
curFile.IsIncomplete = true
+ curFile.IsIncompleteLineTooLong = true
for isFragment {
lineBytes, isFragment, err = input.ReadLine()
if err != nil {
@@ -1073,6 +1076,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio
}
if len(line) > maxLineCharacters {
curFile.IsIncomplete = true
+ curFile.IsIncompleteLineTooLong = true
line = line[:maxLineCharacters]
}
curSection.Lines[len(curSection.Lines)-1].Content = line
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 4408d52575..9a2f7bdd7f 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -53,7 +53,13 @@
</div>
<span class="file mono">{{$file.Name}}</span>
<div class="diff-file-header-actions df ac">
- <div class="text grey">{{$.i18n.Tr "repo.diff.file_suppressed"}}</div>
+ <div class="text grey">
+ {{if $file.IsIncompleteLineTooLong}}
+ {{$.i18n.Tr "repo.diff.file_suppressed_line_too_long"}}
+ {{else}}
+ {{$.i18n.Tr "repo.diff.file_suppressed"}}
+ {{end}}
+ </div>
{{if $file.IsProtected}}
<span class="ui basic label">{{$.i18n.Tr "repo.diff.protected"}}</span>
{{end}}