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
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.
@@ -935,6 +936,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio · 340 unmodified lines
935936 for {
936937 for isFragment {
937938 curFile.IsIncomplete = true
939+ curFile.IsIncompleteLineTooLong = true
938940 _, isFragment, err = input.ReadLine()
939941 if err != nil {
940942 // 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
10621064 line := string(lineBytes)
10631065 if isFragment {
10641066 curFile.IsIncomplete = true
1067+ curFile.IsIncompleteLineTooLong = true
10651068 for isFragment {
10661069 lineBytes, isFragment, err = input.ReadLine()
10671070 if err != nil {
@@ -1073,6 +1076,7 @@ func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio · 5 unmodified lines
10731076 }
10741077 if len(line) > maxLineCharacters {
10751078 curFile.IsIncomplete = true
1079+ curFile.IsIncompleteLineTooLong = true
10761080 line = line[:maxLineCharacters]
10771081 }
10781082 curSection.Lines[len(curSection.Lines)-1].Content = line