gitk: Fix display of diff lines beginning with --- or +++
Lines in a diff beginning with --- or +++ were not being displayed at all. Thanks to Robert Fitzsimons for pointing out the obvious fix, that lines beginning with --- or +++ are only to be suppressed in the diff header. I also took the opportunity to replace a regexp call with a couple of string compare calls, which should be faster. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Mar 8, 2006 at 09:15 UTC
b06bc2a0784cfb5cd9e1313201a16e08c73ff1c6
1 file changed
+3
-1
gitk
+3
-1
@@ -2615,7 +2615,9 @@ proc getblobdiffline {bdf ids} {
2615
set pad [string range "----------------------------------------" 1 $l]
2616
$ctext insert end "$pad $header $pad\n" filesep
2617
set diffinhdr 1
2618
- } elseif {[regexp {^(---|\+\+\+)} $line]} {
2618
+ } elseif {$diffinhdr && [string compare -length 3 $line "---"] == 0} {
2619
+ # do nothing
2620
+ } elseif {$diffinhdr && [string compare -length 3 $line "+++"] == 0} {
2621
set diffinhdr 0
2622
} elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \
2623
$line match f1l f1c f2l f2c rest]} {