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

Re: [PATCH] mergetool-lib: fix default tool selection

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 19, 2015, 17:39 UTC
Message-ID
<xmqqbngba98j.fsf@gitster.dls.corp.google.com>
In-Reply-To
<a9844fc48424d5caf27cc2189af3d9d867d01833.1434706187.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 11 quoted lines
> When no diff nor merge tool is specified (config, option), mergetool-lib
> is supposed to choose a default tool from a set of tools. That set is
> constructed dynamically depending on the environment (graphical, editor
> setting) as a space separated string of tool names.
>
> 719518f (mergetool--lib: set IFS for difftool and mergetool, 2015-05-20)
> introduced a newline as IFS which breaks the parsing of the space
> separated list into items, resulting in a failed search for an available
> tool.
>
> Set IFS to a space locally for the tool search.

I wondered where this "locally" is ensured; it turns out that this shell function is supposed to be always called inside $() to return its result via its standard output ;-)

So I think this change makes sense.
Show 17 quoted lines
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
>  git-mergetool--lib.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> index 14b039d..54ac8e4 100644
> --- a/git-mergetool--lib.sh
> +++ b/git-mergetool--lib.sh
> @@ -305,6 +305,7 @@ guess_merge_tool () {
>  	EOF
>  
>  	# Loop over each candidate and stop when a valid merge tool is found.
> +	IFS=' '
>  	for tool in $tools
>  	do
>  		is_available "$tool" && echo "$tool" && return 0
Previous: Michael J Gruber
Message 2 of 2 in “mergetool-lib: fix default tool selection”
  1. mergetool-lib: fix default tool selectionMichael J Gruber, Jun 19, 2015
  2. Junio C HamanoJun 19, 2015

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.