git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 20, 2020, 10:28 UTC
Message-ID
<568f42a0-f630-64ca-9f77-183dcaa56d1e@kdbg.org>
In-Reply-To
<c4f2330f-715b-1745-5ad7-5477f4e833db@gmail.com>
Am 20.12.20 um 03:13 schrieb Philippe Blain:
Show 25 quoted lines
> 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...

If possible, please do not use sub-processes like in your suggested patch. How about

		variants="$variants
$(list_tool_variants)"

It leaves a blank line at the beginning of $variants instead of the end and should not make a difference in the outcome of

	variants="$(echo "$variants" | sort | uniq)"
BTW, is `sort -u` not available everywhere?
-- Hannes
Previous: Philippe BlainNext: René Scharfe
Message 7 of 13 in “[BUG] Regression in 'git mergetool --tool-help'”
  1. Philippe BlainDec 19, 2020
  2. Felipe ContrerasDec 19, 2020
  3. Junio C HamanoDec 19, 2020
  4. Felipe ContrerasDec 19, 2020
  5. Junio C HamanoDec 19, 2020
  6. Philippe BlainDec 20, 2020
  7. Johannes SixtDec 20, 2020
  8. René ScharfeDec 20, 2020
  9. Junio C HamanoDec 20, 2020
  10. Philippe BlainDec 20, 2020
  11. Junio C HamanoDec 21, 2020
  12. Junio C HamanoDec 20, 2020
  13. Junio C HamanoDec 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.