All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs
@ 2019-12-15 18:25 Роман Донченко
  2020-04-13  5:11 ` Paul Mackerras
  0 siblings, 1 reply; 3+ messages in thread
From: Роман Донченко @ 2019-12-15 18:25 UTC (permalink / raw)
  To: paulus
  Cc: git,
	Роман
	Донченко

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: Роман Донченко <dpb@corrigendum.ru>
---
 gitk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gitk b/gitk
index da84e22..2a9bd45 100755
--- a/gitk
+++ b/gitk
@@ -8224,10 +8224,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.24.1.windows.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs
  2019-12-15 18:25 [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs Роман Донченко
@ 2020-04-13  5:11 ` Paul Mackerras
  2020-04-29 23:11   ` Роман Донченко
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Mackerras @ 2020-04-13  5:11 UTC (permalink / raw)
  To: Роман
	Донченко
  Cc: git

On Sun, Dec 15, 2019 at 09:25:50PM +0300, Роман Донченко wrote:
> 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: Роман Донченко <dpb@corrigendum.ru>

Thanks, applied.

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs
  2020-04-13  5:11 ` Paul Mackerras
@ 2020-04-29 23:11   ` Роман Донченко
  0 siblings, 0 replies; 3+ messages in thread
From: Роман Донченко @ 2020-04-29 23:11 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

Hi,

I just checked the repository, and it doesn't seem like it's actually 
applied...

-Roman.

13.04.2020 8:11, Paul Mackerras пишет:
> On Sun, Dec 15, 2019 at 09:25:50PM +0300, Роман Донченко wrote:
>> 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: Роман Донченко <dpb@corrigendum.ru>
> 
> Thanks, applied.
> 
> Paul.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-29 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 18:25 [PATCH] gitk: fix the context menu not appearing in the presence of submodule diffs Роман Донченко
2020-04-13  5:11 ` Paul Mackerras
2020-04-29 23:11   ` Роман Донченко

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.