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

Re: trustExitCode doesn't apply to vimdiff mergetool

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 28, 2016, 17:17 UTC
Message-ID
<xmqq4m2rle16.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161128021554.GA30863@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 10 quoted lines
> deltawalker, diffmerge, emerge, kdiff3, kompare, and tkdiff originally
> provided behavior that matched trustExitCode=true.
>
> The default for all tools is trustExitCode=false, which conflicts with
> these tools' defaults.  Allow tools to advertise their own default value
> for trustExitCode so that users do not need to opt-in to the original
> behavior.
>
> While this makes the default inconsistent between tools, it can still be
> overridden, and it makes it consistent with the current Git behavior.

I think this is sensible, because the way I look at this issue is that in an ideal world, we would want all tool backends consistently give us usable exit codes, but some tools are known to give unusable exit codes, so we ignore their exit codes by default.

As to the implementation, I think you can reduce the duplication by having each tool backend

 - export a new function that echos "true" or "false"; or
 - export a new function that returns true or false; or
 - set a variable whose value is either "true" or "false"

and use that from the trust_exit_code() in git-mergetool--lib.sh. Something like this (for the second alternative).

    trust_exit_code () {
        if git config --bool "mergtool.$.trustExitCode"
	then
		:; # OK
	elif mergetool_exitcode_trustable
	then
		echo true
	else
		echo false
        fi
    }
Previous: David Aguilar
Message 8 of 8 in “trustExitCode doesn't apply to vimdiff mergetool”
  1. Dun PealNov 27, 2016
  2. Jeff KingNov 27, 2016
  3. Dun PealNov 27, 2016
  4. Jeff KingNov 27, 2016
  5. David AguilarNov 28, 2016
  6. Jeff KingNov 28, 2016
  7. David AguilarNov 28, 2016
  8. Junio C HamanoNov 28, 2016

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.