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>
Pat Thoyts committed
Mar 16, 2009 at 10:24 UTC
681c3290e379e61f9dd762039f140296434d1d9f
1 file changed
+3
-2
gitk
+3
-2
@@ -7216,7 +7216,7 @@ proc getblobdiffs {ids} {
7216
set diffnparents 0
7217
set diffinhdr 0
7218
set diffencoding [get_path_encoding {}]
7219
- fconfigure $bdf -blocking 0 -encoding binary
7219
+ fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
7220
set blobdifffd($ids) $bdf
7221
filerun $bdf [list getblobdiffline $bdf $diffids]
7222
}
@@ -7367,7 +7367,8 @@ proc getblobdiffline {bdf ids} {
7367
$ctext insert end "$line\n" filesep
7368
7369
} else {
7370
- set line [encoding convertfrom $diffencoding $line]
7370
+ set line [string map {\x1A ^Z} \
7371
+ [encoding convertfrom $diffencoding $line]]
7372
# parse the prefix - one ' ', '-' or '+' for each parent
7373
set prefix [string range $line 0 [expr {$diffnparents - 1}]]
7374
set tag [expr {$diffnparents > 1? "m": "d"}]