From 681c3290e379e61f9dd762039f140296434d1d9f Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 16 Mar 2009 10:24:40 +0000 Subject: [PATCH] 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 Signed-off-by: Paul Mackerras --- gitk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 1773ae63eb..d7de27e75d 100755 --- a/gitk +++ b/gitk @@ -7216,7 +7216,7 @@ proc getblobdiffs {ids} { set diffnparents 0 set diffinhdr 0 set diffencoding [get_path_encoding {}] - fconfigure $bdf -blocking 0 -encoding binary + fconfigure $bdf -blocking 0 -encoding binary -eofchar {} set blobdifffd($ids) $bdf filerun $bdf [list getblobdiffline $bdf $diffids] } @@ -7367,7 +7367,8 @@ proc getblobdiffline {bdf ids} { $ctext insert end "$line\n" filesep } else { - set line [encoding convertfrom $diffencoding $line] + set line [string map {\x1A ^Z} \ + [encoding convertfrom $diffencoding $line]] # parse the prefix - one ' ', '-' or '+' for each parent set prefix [string range $line 0 [expr {$diffnparents - 1}]] set tag [expr {$diffnparents > 1? "m": "d"}] -- 2.11.4.GIT