History

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>

Loutro committed 5 years ago

Commit 34b21621 parent 1cd30173 files · +27 −16Browse files

Showing the changes to services/gitdiff/gitdiff.go (1 of 3 files). Show all

Unified · Split

services/gitdiff/gitdiff.go+19−15
@@ -574,21 +574,22 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem · 573 unmodified lines
574 574
575// DiffFile represents a file diff.575// DiffFile represents a file diff.
576type DiffFile struct {576type DiffFile struct {
577 Name string577 Name string
578 OldName string578 OldName string
579 Index int579 Index int
580 Addition, Deletion int580 Addition, Deletion int
581 Type DiffFileType581 Type DiffFileType
582 IsCreated bool582 IsCreated bool
583 IsDeleted bool583 IsDeleted bool
584 IsBin bool584 IsBin bool
585 IsLFSFile bool585 IsLFSFile bool
586 IsRenamed bool586 IsRenamed bool
587 IsAmbiguous bool587 IsAmbiguous bool
588 IsSubmodule bool588 IsSubmodule bool
589 Sections []*DiffSection589 Sections []*DiffSection
590 IsIncomplete bool590 IsIncomplete bool
591 IsProtected bool591 IsIncompleteLineTooLong bool
592 IsProtected bool
592}593}
593 594
594// GetType returns type of diff file.595// GetType returns type of diff file.
@@ -935,6 +936,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio · 340 unmodified lines
935 for {936 for {
936 for isFragment {937 for isFragment {
937 curFile.IsIncomplete = true938 curFile.IsIncomplete = true
939 curFile.IsIncompleteLineTooLong = true
938 _, isFragment, err = input.ReadLine()940 _, isFragment, err = input.ReadLine()
939 if err != nil {941 if err != nil {
940 // Now by the definition of ReadLine this cannot be io.EOF942 // Now by the definition of ReadLine this cannot be io.EOF
@@ -1062,6 +1064,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio · 121 unmodified lines
1062 line := string(lineBytes)1064 line := string(lineBytes)
1063 if isFragment {1065 if isFragment {
1064 curFile.IsIncomplete = true1066 curFile.IsIncomplete = true
1067 curFile.IsIncompleteLineTooLong = true
1065 for isFragment {1068 for isFragment {
1066 lineBytes, isFragment, err = input.ReadLine()1069 lineBytes, isFragment, err = input.ReadLine()
1067 if err != nil {1070 if err != nil {
@@ -1073,6 +1076,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio · 5 unmodified lines
1073 }1076 }
1074 if len(line) > maxLineCharacters {1077 if len(line) > maxLineCharacters {
1075 curFile.IsIncomplete = true1078 curFile.IsIncomplete = true
1079 curFile.IsIncompleteLineTooLong = true
1076 line = line[:maxLineCharacters]1080 line = line[:maxLineCharacters]
1077 }1081 }
1078 curSection.Lines[len(curSection.Lines)-1].Content = line1082 curSection.Lines[len(curSection.Lines)-1].Content = line