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

Re: [PATCH v2] difftool: always honor fatal error exit codes

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2016, 22:26 UTC
Message-ID
<xmqq4m6lfz35.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160815215439.kwt4jmjrtcufjmih@john.keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
> Here's what that looks like.

Sounds good. It feels a bit funny to see that new mentions of $status are unquoted (which is totally valid because we know it has $? that cannot be anything other than a short decimal integer), while the one in the post-context quotes it, but that's not a huge issue.

Will queue.  Thanks.
Show 39 quoted lines
>  git-difftool--helper.sh | 7 +++++++
>  t/t7800-difftool.sh     | 6 ++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
> index 84d6cc0..7bfb673 100755
> --- a/git-difftool--helper.sh
> +++ b/git-difftool--helper.sh
> @@ -86,6 +86,13 @@ else
>  	do
>  		launch_merge_tool "$1" "$2" "$5"
>  		status=$?
> +		if test $status -ge 126
> +		then
> +			# Command not found (127), not executable (126) or
> +			# exited via a signal (>= 128).
> +			exit $status
> +		fi
> +
>  		if test "$status" != 0 &&
>  			test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
>  		then
> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index 2974900..70a2de4 100755
> --- a/t/t7800-difftool.sh
> +++ b/t/t7800-difftool.sh
> @@ -124,6 +124,12 @@ test_expect_success PERL 'difftool stops on error with --trust-exit-code' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success PERL 'difftool honors exit status if command not found' '
> +	test_config difftool.nonexistent.cmd i-dont-exist &&
> +	test_config difftool.trustExitCode false &&
> +	test_must_fail git difftool -y -t nonexistent branch
> +'
> +
>  test_expect_success PERL 'difftool honors --gui' '
>  	difftool_test_setup &&
>  	test_config merge.tool bogus-tool &&
Previous: John Keeping
Message 5 of 5 in “Re: [PATCH] difftool: always honor "command not found" exit code”
  1. Tom Tanner (BLOOMBERG/ LONDON)Aug 15, 2016
  2. Junio C HamanoAug 15, 2016
  3. John KeepingAug 15, 2016
  4. difftool: always honor fatal error exit codesJohn Keeping, Aug 15, 2016
  5. Junio C HamanoAug 15, 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.