aboutsummaryrefslogtreecommitdiffstats
path: root/services/gitdiff
diff options
context:
space:
mode:
authorLoutro <loutro@gandev.com>2021-05-04 14:58:49 +0200
committerGitHub <noreply@github.com>2021-05-04 13:58:49 +0100
commit34b21625c2e7fc78e16d2ab99e07302d769ddc6d (patch)
treec63126b7d9c98f3aa0390e2b933bd42c80759e53 /services/gitdiff
parent1cd301796c23153a398acc1049428b1b1fb4354a (diff)
downloadgitea-34b21625c2e7fc78e16d2ab99e07302d769ddc6d.tar.gz
gitea-34b21625c2e7fc78e16d2ab99e07302d769ddc6d.zip
Display specific message if diff is not displayed because of too long line (#15611)
* 7184- message if line too long * Update options/locale/locale_en-US.ini Co-authored-by: silverwind <me@silverwind.io> * add flag on missing cases Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services/gitdiff')
-rw-r--r--services/gitdiff/gitdiff.go34
1 files changed, 19 insertions, 15 deletions
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