public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: John Keeping <john@keeping•me.uk>
Cc: "Tom Tanner \(BLOOMBERG\/ LONDON\)" <ttanner2@bloomberg•net>,
	davvid@gmail•com, git@vger•kernel.org
Subject: Re: [PATCH v2] difftool: always honor fatal error exit codes
Date: Mon, 15 Aug 2016 15:26:38 -0700	[thread overview]
Message-ID: <xmqq4m6lfz35.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160815215439.kwt4jmjrtcufjmih@john.keeping.me.uk> (John Keeping's message of "Mon, 15 Aug 2016 22:54:39 +0100")

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.

>  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 &&

      reply	other threads:[~2016-08-15 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 10:38 [PATCH] difftool: always honor "command not found" exit code Tom Tanner (BLOOMBERG/ LONDON)
2016-08-15 20:21 ` Junio C Hamano
2016-08-15 21:35   ` John Keeping
2016-08-15 21:54     ` [PATCH v2] difftool: always honor fatal error exit codes John Keeping
2016-08-15 22:26       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4m6lfz35.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=davvid@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=john@keeping$(echo .)me.uk \
    --cc=ttanner2@bloomberg$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox