From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Redefine semantics of find_unique_abbrev()
Date: Sun, 2 Mar 2008 02:42:30 -0500 [thread overview]
Message-ID: <20080302074230.GD3935@coredump.intra.peff.net> (raw)
In-Reply-To: <7vd4qdtw7k.fsf@gitster.siamese.dyndns.org>
On Sat, Mar 01, 2008 at 11:35:11PM -0800, Junio C Hamano wrote:
> That is, "for objects we have, make sure it uniquely identifies,
> otherwise, make sure the phoney name is long enough such that it would not
> name any existing object".
I think your logic is correct, and I think naming it 'exists' is more
readable (I don't have a tendency not to double-negate).
But...
> - if (!status ||
> - (is_null && status != SHORT_NAME_AMBIGUOUS)) {
> + if (exists
> + ? !status
> + : status == SHORT_NAME_NOT_FOUND) {
> hex[len] = 0;
> return hex;
> }
Maybe it is just me, but I find the ternary operator here reduces
readability. I would have liked the more verbose:
if ((exists && !status) ||
(!exists && status == SHORT_NAME_NOT_FOUND)) {
But now I am just painting your bikeshed.
-Peff
next prev parent reply other threads:[~2008-03-02 7:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 1:41 Redefine semantics of find_unique_abbrev() Junio C Hamano
2008-03-01 5:06 ` Jeff King
2008-03-02 7:35 ` Junio C Hamano
2008-03-02 7:42 ` Jeff King [this message]
2008-03-02 8:11 ` Junio C Hamano
2008-03-02 7:49 ` [PATCH] Clean up find_unique_abbrev() callers Junio C Hamano
2008-03-02 7:51 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080302074230.GD3935@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).