@matheusbsbs / matheus-bagliano / commits / f177c49a97
Fork 0

gitk: don't highlight files after submodules as submodules

gitk applies submodule highlighting (coloring lines starting with " >" and " <") when `currdiffsubmod` is not an empty string. However, it fails to reset `currdiffsubmod` after a submodule diff ends, so any file diffs following a submodule diff will still be highlighted as if they were submodule diffs. There are two problems with the way gitk tries to reset `currdiffsubmod`: 1. The code says `set $currdiffsubmod` instead of `set currdiffsubmod`, so it actually sets the variable whose name is the submodule path instead. 2. It tries to do it after the first line in a submodule diff, which is incorrect, since submodule diffs can contain multiple lines. Fix this by resetting `currdiffsubmod` when a file diff starts. Signed-off-by: Роман Донченко <dpb@corrigendum.ru> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Роман Донченко committed Nov 2, 2019 at 02:34 UTC f177c49a97d16aab490aa34fa52e113c21de4a1f
1 file changed +2 -2
gitk
+2 -2
@@ -8150,6 +8150,8 @@ proc parseblobdiffline {ids line} {
8150 }
8151 # start of a new file
8152 set diffinhdr 1
8153 + set currdiffsubmod ""
8154 +
8155 $ctext insert end "\n"
8156 set curdiffstart [$ctext index "end - 1c"]
8157 lappend ctext_file_names ""
@@ -8233,11 +8235,9 @@ proc parseblobdiffline {ids line} {
8235 $ctext insert end "$line\n" filesep
8236 }
8237 } elseif {$currdiffsubmod != "" && ![string compare -length 3 " >" $line]} {
8236 - set $currdiffsubmod ""
8238 set line [encoding convertfrom $diffencoding $line]
8239 $ctext insert end "$line\n" dresult
8240 } elseif {$currdiffsubmod != "" && ![string compare -length 3 " <" $line]} {
8240 - set $currdiffsubmod ""
8241 set line [encoding convertfrom $diffencoding $line]
8242 $ctext insert end "$line\n" d0
8243 } elseif {$diffinhdr} {