Thread (6 messages) flat view 6 messages, 4 authors, 2020-12-21

Re: [BUG] Regression in 'git mergetool --tool-help'

From: Philippe Blain <hidden>
Date: 2020-12-20 02:14:39

Possibly related (same subject, not in this thread)

Hi Junio,
Hi Felipe,

Le 2020-12-19 à 12:13, Junio C Hamano a écrit :
Felipe Contreras [off-list ref] writes:
quoted
Junio C Hamano wrote:
quoted
Felipe Contreras [off-list ref] writes:
quoted
How about this?
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -46,7 +46,7 @@ show_tool_names () {
                 while read scriptname
                 do
                         setup_tool "$scriptname" 2>/dev/null
-                       variants="$variants$(list_tool_variants)\n"
+                       variants="$variants$(list_tool_variants)"$'\n'
                 done
                 variants="$(echo "$variants" | sort | uniq)"
Ah, I didn't see your variant before sending mine.  $'\n' would work
with bash but we prefer not to rely on bashisms here.
Thanks for both answers. Felipe's solution does the trick, but Junio's does not;
it seems we do have to have a newline there. The following also works, and I think
is portable:
diff --git i/git-mergetool--lib.sh w/git-mergetool--lib.sh
index 2defef28cd..6f03975493 100644
--- i/git-mergetool--lib.sh
+++ w/git-mergetool--lib.sh
@@ -46,7 +46,7 @@ show_tool_names () {
  		while read scriptname
  		do
  			setup_tool "$scriptname" 2>/dev/null
-			variants="$variants$(list_tool_variants)\n"
+			variants="$(echo "$variants" && list_tool_variants)"
  		done
  		variants="$(echo "$variants" | sort | uniq)"
I figured out what was different between the different Ubuntu versions I was testing:
the Ubuntu 14 and 18 systems have Bash as /bin/sh, but my Ubuntu 20 system
has /usr/bin/dash as /bin/sh (the default for Ubuntu these days).

I'll try to send a formal patch with the diff above, time permitting...

Also of note: I was wondering why 'araxis' was showing up in the list of available tools,
as Araxis Merge is macOS and Windows only (!). Turns out that the imagemagick package installs
a /usr/bin/compare symlink to /usr/bin/compare-im6.q16, so since Araxis merge is registered in
mergetools/araxis::translate_merge_tool_path as 'compare', it ends up in the list of available
merge tools... I think we could do better here but I'm not sure how.

Cheers,

Philippe.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help