From: Junio C Hamano <gitster@pobox.com>
To: demerphq <demerphq@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: should git rev-parse -q --verify on a range produce output?
Date: Sun, 08 Jan 2023 11:34:38 +0900 [thread overview]
Message-ID: <xmqqmt6tzrcx.fsf@gitster.g> (raw)
In-Reply-To: <CANgJU+Vo3B=YuqgWVgiRMMiBwTFEh98O0LSJJ+ES6EM=MP4Cew@mail.gmail.com> (demerphq@gmail.com's message of "Sun, 8 Jan 2023 00:03:55 +0100")
demerphq <demerphq@gmail.com> writes:
> I was curious if it is a bug that `rev-parse -q --verify` produces
> output for a commit range, and only reveals it is supposed to be used
> with a single commit as an error message?
I know that the original scenario that the combination of "--verify"
and "--quiet" was invented for was "I have a string that ought to
resolve to a single object name, but the object may be missing", and
if git cat-file -e "$name" 2>/dev/null
then
rawname=$(git rev-parse --verify "$name")
true
else
false
fi &&
... do something that uses $rawname here ...
is a mouthful. It becomes easier to use if we can say
rawname=$(git rev-parse -q --verify "$name") &&
... do something that uses $rawname here ...
I do not think the behaviour in usecase outside that was carefully
designed to the details.
next prev parent reply other threads:[~2023-01-08 2:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 23:03 should git rev-parse -q --verify on a range produce output? demerphq
2023-01-08 2:34 ` Junio C Hamano [this message]
2023-01-08 10:45 ` demerphq
2023-01-09 3:51 ` Junio C Hamano
2023-01-09 9:04 ` demerphq
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=xmqqmt6tzrcx.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=demerphq@gmail.com \
--cc=git@vger.kernel.org \
/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).