From a99bc27aec74071aa1e9ecaa12c642e88e377165 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=94=D0=BE=D0=BD=D1=87?= =?utf8?q?=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sun, 15 Dec 2019 21:25:50 +0300 Subject: [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: Роман Донченко Signed-off-by: Paul Mackerras --- gitk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitk b/gitk index 88c986884f..ca6c8068f0 100755 --- a/gitk +++ b/gitk @@ -8231,10 +8231,10 @@ proc parseblobdiffline {ids line} { if {$currdiffsubmod != $fname} { $ctext insert end "\n"; # Add newline after commit message } - set curdiffstart [$ctext index "end - 1c"] - lappend ctext_file_names "" if {$currdiffsubmod != $fname} { - lappend ctext_file_lines $fname + set curdiffstart [$ctext index "end - 1c"] + lappend ctext_file_names "" + lappend ctext_file_lines [lindex [split $curdiffstart "."] 0] makediffhdr $fname $ids set currdiffsubmod $fname $ctext insert end "\n$line\n" filesep -- 2.39.5