All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Francis Moreau <francis.moro@gmail.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: revision: propagate flag bits from tags to pointees
Date: Wed, 15 Jan 2014 14:41:21 -0800	[thread overview]
Message-ID: <xmqqfvoo27hq.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqk3e0288d.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Wed, 15 Jan 2014 14:25:22 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> But I have a suspicion that my patch may break if any codepath looks
> at the current flag on the object and decides "ah, it already is
> marked" and punts.
>
> It indeed looks like mark_tree_uninteresting() does have that
> property.  When an uninteresting tag directly points at a tree, if
> we propagate the UNINTERESTING bit to the pointee while peeling,
> wouldn't we end up calling mark_tree_uninteresting() on a tree,
> whose flags already have UNINTERESTING bit set, causing it not to
> recurse?

Extending that line of thought further, what should this do?

    git rev-list --objects ^HEAD^^{tree} HEAD^{tree} |
    git pack-object --stdin pack

It says "I am interested in the objects that is used in the tree of
HEAD, but I do not need those that already appear in HEAD^".

With the current code (with or without the fix under discussion, or
even without the faulty "do not peel tags used in range notation"),
the tree of the HEAD^ is marked in handle_revision_arg() as
UNINTERESTING when it is placed in revs->pending.objects[], and the
handle_commit() --- we should rename it to handle_pending_object()
or something, by the way --- will call mark_tree_uninteresting() on
that tree, which then would say "It is already uninteresting" and
return without marking the objects common to these two trees
uninteresting, no?

I think that is a related but separate bug that dates back to
prehistoric times, and the asymmetry between handle_commit() deals
with commits and trees should have been a clear clue that tells us
something is fishy.  It calls "mark PARENTS uninteresting", leaving
the responsibility of marking the commit itself to the caller, but
it calls mark_tree_uninteresting() whose caller is not supposed to
mark the tree itself.

Which suggest me that a right fix for this separate bug would be to
introduce mark_tree_contents_uninteresting() or something, which has
the parallel semantics to mark_parents_uninteresting().  Then
mark_blob_uninteresting() call in the function can clearly go.  Such
a change will make it clear that handle_commit() is responsible for
handling the flags for the given object, and any helper functions
called by it should not peek and stop the flag of the object itself
when deciding to recurse into the objects linked to it.

  reply	other threads:[~2014-01-15 22:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 13:15 git-log --cherry-pick gives different results when using tag or tag^{} Francis Moreau
2014-01-15  9:49 ` Jeff King
2014-01-15  9:59   ` Francis Moreau
2014-01-15 19:57   ` Junio C Hamano
2014-01-15 20:26     ` revision: propagate flag bits from tags to pointees Junio C Hamano
2014-01-15 21:56       ` Jeff King
2014-01-15 22:25         ` Junio C Hamano
2014-01-15 22:41           ` Junio C Hamano [this message]
2014-01-15 21:53     ` git-log --cherry-pick gives different results when using tag or tag^{} 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=xmqqfvoo27hq.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=francis.moro@gmail.com \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.