Skip to content

Commit f177c49

Browse files
SpecLadpaulusmack
authored andcommitted
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: Роман Донченко <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent d4247e0 commit f177c49

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8150,6 +8150,8 @@ proc parseblobdiffline {ids line} {
81508150
}
81518151
# start of a new file
81528152
set diffinhdr 1
8153+
set currdiffsubmod ""
8154+
81538155
$ctext insert end "\n"
81548156
set curdiffstart [$ctext index "end - 1c"]
81558157
lappend ctext_file_names ""
@@ -8233,11 +8235,9 @@ proc parseblobdiffline {ids line} {
82338235
$ctext insert end "$line\n" filesep
82348236
}
82358237
} elseif {$currdiffsubmod != "" && ![string compare -length 3 " >" $line]} {
8236-
set $currdiffsubmod ""
82378238
set line [encoding convertfrom $diffencoding $line]
82388239
$ctext insert end "$line\n" dresult
82398240
} elseif {$currdiffsubmod != "" && ![string compare -length 3 " <" $line]} {
8240-
set $currdiffsubmod ""
82418241
set line [encoding convertfrom $diffencoding $line]
82428242
$ctext insert end "$line\n" d0
82438243
} elseif {$diffinhdr} {

0 commit comments

Comments
 (0)