Skip to content

Commit 681c329

Browse files
patthoytspaulusmack
authored andcommitted
gitk: Handle blobs containing a DOS end-of-file marker
If a patchset contains an EOF marker (Ctrl-Z) the blob diff terminates at that point. This permits gitk to ignore the eof and continue to display any subsequent blobs and also displays a sensible representation of the eof char. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 52b8ea9 commit 681c329

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

gitk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7216,7 +7216,7 @@ proc getblobdiffs {ids} {
72167216
set diffnparents 0
72177217
set diffinhdr 0
72187218
set diffencoding [get_path_encoding {}]
7219-
fconfigure $bdf -blocking 0 -encoding binary
7219+
fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
72207220
set blobdifffd($ids) $bdf
72217221
filerun $bdf [list getblobdiffline $bdf $diffids]
72227222
}
@@ -7367,7 +7367,8 @@ proc getblobdiffline {bdf ids} {
73677367
$ctext insert end "$line\n" filesep
73687368

73697369
} else {
7370-
set line [encoding convertfrom $diffencoding $line]
7370+
set line [string map {\x1A ^Z} \
7371+
[encoding convertfrom $diffencoding $line]]
73717372
# parse the prefix - one ' ', '-' or '+' for each parent
73727373
set prefix [string range $line 0 [expr {$diffnparents - 1}]]
73737374
set tag [expr {$diffnparents > 1? "m": "d"}]

0 commit comments

Comments
 (0)