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

Re: [PATCH 1/2] mergetool: honor mergetool.$tool.trustExitCode for built-in tools

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 29, 2016, 18:57 UTC
Message-ID
<xmqq37iaglm1.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161129093807.24637-1-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 46 quoted lines
> Built-in merge tools contain a hard-coded assumption about
> whether or not a tool's exit code can be trusted to determine
> the success or failure of a merge.  Tools whose exit codes are
> not trusted contain calls to check_unchanged() in their
> merge_cmd() functions.
>
> A problem with this is that the trustExitCode configuration is
> not honored for built-in tools.
>
> Teach built-in tools to honor the trustExitCode configuration.
> Extend run_merge_cmd() so that it is responsible for calling
> check_unchanged() when a tool's exit code cannot be trusted.
> Remove check_unchanged() calls from scriptlets since they are no
> longer responsible for calling it.
>
> When no configuration is present, exit_code_trustable() is
> checked to see whether the exit code should be trusted.
> The default implementation returns false.
>
> Tools whose exit codes can be trusted override
> exit_code_trustable() to true.
>
> Reported-by: Dun Peal <dunpealer@gmail.com>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
>  git-mergetool--lib.sh    | 56 ++++++++++++++++++++++++++++++++++++++----------
>  mergetools/araxis        |  2 --
>  mergetools/bc            |  2 --
>  mergetools/codecompare   |  2 --
>  mergetools/deltawalker   |  6 +++++-
>  mergetools/diffmerge     |  4 ++++
>  mergetools/diffuse       |  2 --
>  mergetools/ecmerge       |  2 --
>  mergetools/emerge        |  4 ++++
>  mergetools/examdiff      |  2 --
>  mergetools/kdiff3        |  4 ++++
>  mergetools/kompare       |  4 ++++
>  mergetools/meld          |  3 +--
>  mergetools/opendiff      |  2 --
>  mergetools/p4merge       |  2 --
>  mergetools/tkdiff        |  4 ++++
>  mergetools/tortoisemerge |  2 --
>  mergetools/vimdiff       |  2 --
>  mergetools/winmerge      |  2 --
>  mergetools/xxdiff        |  2 --
>  20 files changed, 71 insertions(+), 38 deletions(-)

OK, so the idea is that the backends that used to touch $BACKUP and used to call check_unchanged stop doing these two things, while other backends override exit_code_trustable(). That makes the change to the backends very straightforward to understand.

Show 13 quoted lines
>  # Run a either a configured or built-in merge tool
>  run_merge_cmd () {
> -	merge_cmd "$1"
> +	mergetool_trust_exit_code=$(trust_exit_code "$1")
> +	if test "$mergetool_trust_exit_code" = "true"
> +	then
> +		merge_cmd "$1"
> +	else
> +		touch "$BACKUP"
> +		merge_cmd "$1"
> +		check_unchanged
> +	fi
>  }
Looks sensible.  Thanks.  Will queue.
Previous: David Aguilar
Message 2 of 2 in “mergetool: honor mergetool.$tool.trustExitCode for built-in tools”
  1. 1/2 mergetool: honor mergetool.$tool.trustExitCode for built-in toolsDavid Aguilar, Nov 29, 2016
  2. Junio C HamanoNov 29, 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.