From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Abhishek Kumar <abhishekkumar8222@gmail.com>,
erlend-a@innova.no, git@vger.kernel.org
Subject: Re: [RFC PATCH] Make rev-parse -q and --is-* quiet
Date: Fri, 13 Mar 2020 11:18:26 -0700 [thread overview]
Message-ID: <xmqqa74kce4t.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200313174755.GA549554@coredump.intra.peff.net> (Jeff King's message of "Fri, 13 Mar 2020 13:47:55 -0400")
Jeff King <peff@peff.net> writes:
> I'm not sure if returning a single is_set makes sense, though. It
> effectively becomes an OR, and you wouldn't know which flag triggered
> it. It would make more sense to me for the invocation above to simply be
> an error, reminding the caller that they need to handle it more
> carefully.
>
> We _could_ encode each value into the exit code (e.g., set bit 1 if the
> first condition was true, and so on). But checking that becomes as much
> hassle as reading stdout, so there's little value.
None of the above excites me. I do not think it makes much sense to
combine -q with --is-* for the reasons you stated already (i.e. the
caller cannot tell between "failure" and "false") in the first
place, but if we must do this:
- reserve 0 (true) and 1 (false) for successful exit and use 2 (or
above) for other failures;
- when --quiet is in use, make --is-* mutually exclusive and die
when more than one of them is given. I think any of the --is-*,
when used with --quiet, should also be an error if there are revs
on the command line (e.g. "git rev-parse --is-inside-git-dir
HEAD" is OK, but not with "--quiet").
is the minimum that makes me feel that we have semi-reasonable
behaviour that can be explained to end users.
next prev parent reply other threads:[~2020-03-13 18:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 17:30 [RFC PATCH] Make rev-parse -q and --is-* quiet Abhishek Kumar
2020-03-13 17:47 ` Jeff King
2020-03-13 18:18 ` Junio C Hamano [this message]
2020-03-13 19:10 ` Erlend Aasland
2020-03-13 17:50 ` Eric Sunshine
-- strict thread matches above, loose matches on Subject: below --
2020-03-13 12:13 Erlend Aasland
2020-03-13 17:52 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa74kce4t.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=abhishekkumar8222@gmail.com \
--cc=erlend-a@innova.no \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).