{"thread":{"id":"52462","subject":"[PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs","startedAt":"2019-12-15T18:34:25Z","lastAt":"2020-04-29T23:18:48Z","messageCount":3,"participants":["Роман Донченко","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"388234","messageId":"20191215182550.397-1-dpb@corrigendum.ru","threadId":"52462","inReplyTo":null,"subject":"[PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs","fromName":"Роман Донченко","fromEmail":"dpb@corrigendum.ru","sentAt":"2019-12-15T18:25:50Z","receivedAt":"2019-12-15T18:34:25Z","isPatch":true,"sender":{"key":"dpb@corrigendum.ru","avatar":"https://avatars.githubusercontent.com/u/2391761?v=4"},"body":"Currently, submodule diffs can cause the diff context menu to fail\nto appear because of a couple bugs in parseblobdiffline:\n\n* it appends the submodule name to ctext_file_lines instead of\n  a line number, which breaks the binary search in find_ctext_fileinfo;\n\n* it can desynchronize ctext_file_names and ctext_file_lines\n  by appending to the former but not the latter, which also breaks\n  find_ctext_fileinfo.\n\nFix both of these.\n\nNote: a side effect of this patch is that the context menu also\nstarts appearing when you right-click on submodule diffs (and not just\nregular diffs). The menu is non-functional in this case, though,\nsince you can't run blame on submodules.\n\nSigned-off-by: Роман Донченко <dpb@corrigendum.ru>\n---\n gitk | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex da84e22..2a9bd45 100755\n--- a/gitk\n+++ b/gitk\n@@ -8224,10 +8224,10 @@ proc parseblobdiffline {ids line} {\n \tif {$currdiffsubmod != $fname} {\n \t    $ctext insert end \"\\n\";     # Add newline after commit message\n \t}\n-\tset curdiffstart [$ctext index \"end - 1c\"]\n-\tlappend ctext_file_names \"\"\n \tif {$currdiffsubmod != $fname} {\n-\t    lappend ctext_file_lines $fname\n+\t    set curdiffstart [$ctext index \"end - 1c\"]\n+\t    lappend ctext_file_names \"\"\n+\t    lappend ctext_file_lines [lindex [split $curdiffstart \".\"] 0]\n \t    makediffhdr $fname $ids\n \t    set currdiffsubmod $fname\n \t    $ctext insert end \"\\n$line\\n\" filesep\n-- \n2.24.1.windows.2\n\n"},{"id":"395319","messageId":"20200413051151.GB14888@blackberry","threadId":"52462","inReplyTo":"20191215182550.397-1-dpb@corrigendum.ru","subject":"Re: [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs","fromName":"Paul Mackerras","fromEmail":"paulus@ozlabs.org","sentAt":"2020-04-13T05:11:51Z","receivedAt":"2020-04-13T07:35:07Z","isPatch":true,"sender":{"key":"paulus@ozlabs.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Sun, Dec 15, 2019 at 09:25:50PM +0300, Роман Донченко wrote:\n> Currently, submodule diffs can cause the diff context menu to fail\n> to appear because of a couple bugs in parseblobdiffline:\n> \n> * it appends the submodule name to ctext_file_lines instead of\n>   a line number, which breaks the binary search in find_ctext_fileinfo;\n> \n> * it can desynchronize ctext_file_names and ctext_file_lines\n>   by appending to the former but not the latter, which also breaks\n>   find_ctext_fileinfo.\n> \n> Fix both of these.\n> \n> Note: a side effect of this patch is that the context menu also\n> starts appearing when you right-click on submodule diffs (and not just\n> regular diffs). The menu is non-functional in this case, though,\n> since you can't run blame on submodules.\n> \n> Signed-off-by: Роман Донченко <dpb@corrigendum.ru>\n\nThanks, applied.\n\nPaul.\n"},{"id":"396630","messageId":"58d9c60c-1b0c-ef59-0355-da6edcbc8cdf@corrigendum.ru","threadId":"52462","inReplyTo":"20200413051151.GB14888@blackberry","subject":"Re: [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs","fromName":"Роман Донченко","fromEmail":"dpb@corrigendum.ru","sentAt":"2020-04-29T23:11:04Z","receivedAt":"2020-04-29T23:18:48Z","isPatch":true,"sender":{"key":"dpb@corrigendum.ru","avatar":"https://avatars.githubusercontent.com/u/2391761?v=4"},"body":"Hi,\n\nI just checked the repository, and it doesn't seem like it's actually \napplied...\n\n-Roman.\n\n13.04.2020 8:11, Paul Mackerras пишет:\n> On Sun, Dec 15, 2019 at 09:25:50PM +0300, Роман Донченко wrote:\n>> Currently, submodule diffs can cause the diff context menu to fail\n>> to appear because of a couple bugs in parseblobdiffline:\n>>\n>> * it appends the submodule name to ctext_file_lines instead of\n>>    a line number, which breaks the binary search in find_ctext_fileinfo;\n>>\n>> * it can desynchronize ctext_file_names and ctext_file_lines\n>>    by appending to the former but not the latter, which also breaks\n>>    find_ctext_fileinfo.\n>>\n>> Fix both of these.\n>>\n>> Note: a side effect of this patch is that the context menu also\n>> starts appearing when you right-click on submodule diffs (and not just\n>> regular diffs). The menu is non-functional in this case, though,\n>> since you can't run blame on submodules.\n>>\n>> Signed-off-by: Роман Донченко <dpb@corrigendum.ru>\n> \n> Thanks, applied.\n> \n> Paul.\n> \n"}]}