From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] pack-refs: add fully-peeled trait
Date: Sun, 17 Mar 2013 02:04:08 -0400 [thread overview]
Message-ID: <20130317060408.GE16070@sigill.intra.peff.net> (raw)
In-Reply-To: <51447C5E.3050808@alum.mit.edu>
On Sat, Mar 16, 2013 at 03:06:22PM +0100, Michael Haggerty wrote:
> > refname = parse_ref_line(refline, sha1);
> > if (refname) {
> > - last = create_ref_entry(refname, sha1, flag, 1);
> > + /*
> > + * Older git did not write peel lines for anything
> > + * outside of refs/tags/; if the fully-peeled trait
> > + * is not set, we are dealing with such an older
> > + * git and cannot assume an omitted peel value
> > + * means the ref is not a tag object.
> > + */
> > + int this_flag = flag;
> > + if (!fully_peeled && prefixcmp(refname, "refs/tags/"))
> > + this_flag &= ~REF_KNOWS_PEELED;
> > +
> > + last = create_ref_entry(refname, sha1, this_flag, 1);
> > add_ref(dir, last);
> > continue;
> > }
>
> I have to admit that I am partial to my variant of this code [1] because
> the logic makes it clearer when the affirmative decision can be made to
> set the REF_KNOWS_PEELED flag. But this version also looks correct to
> me and equivalent (aside from the idea that a few lines later if a
> peeled value is found then the REF_KNOWS_PEELED bit could also be set).
Yeah, I think they are equivalent, but I agree yours is a little more
readable. I'll switch it in my re-roll, and I will go ahead and set the
REF_KNOWS_PEELED bit when we see a peel line. That code should not be
triggered in general, but it is the sane thing for the reader to do, so
it makes the code more obvious and readable.
-Peff
next prev parent reply other threads:[~2013-03-17 6:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 9:00 [PATCH 0/2] peel-ref optimization fixes Jeff King
2013-03-16 9:01 ` [PATCH 1/2] pack-refs: write peeled entry for non-tags Jeff King
2013-03-16 13:50 ` Michael Haggerty
2013-03-17 6:02 ` Jeff King
2013-03-16 9:01 ` [PATCH 2/2] pack-refs: add fully-peeled trait Jeff King
2013-03-16 14:06 ` Michael Haggerty
2013-03-17 6:04 ` Jeff King [this message]
2013-03-17 5:50 ` Junio C Hamano
2013-03-17 5:55 ` Jeff King
2013-03-17 8:21 ` [PATCH v2 0/4] peel-ref optimization fixes Jeff King
2013-03-17 8:22 ` [PATCH v2 1/4] avoid segfaults on parse_object failure Jeff King
2013-03-17 8:23 ` [PATCH v2 2/4] use parse_object_or_die instead of die("bad object") Jeff King
2013-03-17 8:23 ` [PATCH v2 3/4] pack-refs: write peeled entry for non-tags Jeff King
2013-03-17 8:28 ` [PATCH v2 4/4] pack-refs: add fully-peeled trait Jeff King
2013-03-17 20:01 ` Junio C Hamano
2013-03-18 11:37 ` [PATCH v3 " Jeff King
2013-03-18 16:26 ` Junio C Hamano
2013-03-18 3:12 ` [PATCH v2 " Michael Haggerty
2013-03-18 15:12 ` Junio C Hamano
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=20130317060408.GE16070@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
/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).