Skip to content

Commit a99bc27

Browse files
SpecLadpaulusmack
authored andcommitted
gitk: fix the context menu not appearing in the presence of submodule diffs
Currently, submodule diffs can cause the diff context menu to fail to appear because of a couple bugs in parseblobdiffline: * it appends the submodule name to ctext_file_lines instead of a line number, which breaks the binary search in find_ctext_fileinfo; * it can desynchronize ctext_file_names and ctext_file_lines by appending to the former but not the latter, which also breaks find_ctext_fileinfo. Fix both of these. Note: a side effect of this patch is that the context menu also starts appearing when you right-click on submodule diffs (and not just regular diffs). The menu is non-functional in this case, though, since you can't run blame on submodules. Signed-off-by: Роман Донченко <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 2faa6cd commit a99bc27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gitk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8231,10 +8231,10 @@ proc parseblobdiffline {ids line} {
82318231
if {$currdiffsubmod != $fname} {
82328232
$ctext insert end "\n"; # Add newline after commit message
82338233
}
8234-
set curdiffstart [$ctext index "end - 1c"]
8235-
lappend ctext_file_names ""
82368234
if {$currdiffsubmod != $fname} {
8237-
lappend ctext_file_lines $fname
8235+
set curdiffstart [$ctext index "end - 1c"]
8236+
lappend ctext_file_names ""
8237+
lappend ctext_file_lines [lindex [split $curdiffstart "."] 0]
82388238
makediffhdr $fname $ids
82398239
set currdiffsubmod $fname
82408240
$ctext insert end "\n$line\n" filesep

0 commit comments

Comments
 (0)