From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Jean-Rémy Falleri" <jr.falleri@gmail.com>,
"David Aguilar" <davvid@gmail.com>
Subject: Re: [PATCH] git-difftool--helper: honor `--trust-exit-code` with `--dir-diff`
Date: Tue, 20 Feb 2024 10:56:34 +0100 [thread overview]
Message-ID: <ZdR3UlDf-Y_pokd0@tanuki> (raw)
In-Reply-To: <xmqqttm8i8hb.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]
On Fri, Feb 16, 2024 at 10:12:32AM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
[snip]
> > diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
> > index e4e820e680..09d8542917 100755
> > --- a/git-difftool--helper.sh
> > +++ b/git-difftool--helper.sh
> > @@ -91,6 +91,20 @@ then
> > # ignore the error from the above --- run_merge_tool
> > # will diagnose unusable tool by itself
> > run_merge_tool "$merge_tool" false
> > +
> > + status=$?
> > + if test $status -ge 126
> > + then
> > + # Command not found (127), not executable (126) or
> > + # exited via a signal (>= 128).
> > + exit $status
> > + fi
>
> So these errors spawning the tool backend are always reported,
> regardless of the trust-exit-code settings. OK.
>
> > + if test "$status" != 0 &&
> > + test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
> > + then
> > + exit $status
> > + fi
>
> I found this somehow harder to reason about than necessary. Just
>
> if test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
> then
> exit $status
> fi
>
> would have been a more straight-forward expression of what we want
> to happen here, i.e. "if we are told to report the tool's exit
> status, we do so, regardless of what the exit status is".
>
> Not that the construct in your patch is wrong---we will exit with 0
> at the end even when "trust-exit-code" thing is true and the tool
> returned success.
Fair point indeed. Looks like I was a bit too lazy here by simply
copying over the construct from the non-dir-diff case. Over there we
need to special case the 0 exit code because we don't want to exit the
loop in that case. But here it's completely unnecessary.
Will adapt, thanks!
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-02-20 9:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 11:09 Git difftool: interaction between --dir-diff and --trust-exit-code Jean-Rémy Falleri
2024-02-16 8:39 ` [PATCH] git-difftool--helper: honor `--trust-exit-code` with `--dir-diff` Patrick Steinhardt
2024-02-16 18:12 ` Junio C Hamano
2024-02-20 9:56 ` Patrick Steinhardt [this message]
2024-02-28 1:52 ` David Aguilar
2024-02-28 2:15 ` Junio C Hamano
2024-02-20 10:08 ` [PATCH v2] " Patrick Steinhardt
2024-03-08 22:12 ` SZEDER Gábor
2024-03-08 22:36 ` Junio C Hamano
2024-03-21 13:50 ` Patrick Steinhardt
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=ZdR3UlDf-Y_pokd0@tanuki \
--to=ps@pks.im \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jr.falleri@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).