Skip to content

Commit

Permalink
gitk: Fix display of diff lines beginning with --- or +++
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mackerras committed Mar 7, 2006
1 parent 9f841cf commit b06bc2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,9 @@ proc getblobdiffline {bdf ids} {
set pad [string range "----------------------------------------" 1 $l]
$ctext insert end "$pad $header $pad\n" filesep
set diffinhdr 1
} elseif {[regexp {^(---|\+\+\+)} $line]} {
} elseif {$diffinhdr && [string compare -length 3 $line "---"] == 0} {
# do nothing
} elseif {$diffinhdr && [string compare -length 3 $line "+++"] == 0} {
set diffinhdr 0
} elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \
$line match f1l f1c f2l f2c rest]} {
Expand Down

0 comments on commit b06bc2a

Please sign in to comment.