Subject: Re: [PATCH v2 1/2] revision: mark contents of an uninteresting tree uninteresting

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Jan 2014 16:35:16 -0800

Jonathan Nieder <[email-masked]> writes:

> Junio C Hamano wrote:
>
>> we see the top-level tree marked as uninteresting (i.e. ^A^{tree} in
>> the above example) and call mark_tree_uninteresting() on it; this
>> unfortunately prevents us from recursing into the tree and marking
>> the objects in the tree as uninteresting.
>
> So the tree is marked uninteresting twice --- once by setting in the
> UNINTERESTING flag in handle_revision_arg() and a second attempted
> time in mark_tree_uninteresting()?   Makes sense.

It is that the original code, the setting of the mark on the object
itself was inconsistent.  For commits, we did that ourselves; for
trees, we let the mark_tree_uninteresting() do so.

And mark_tree_uninteresting() has this quirk that it refuses to
recurse into the given tree, if the tree is already marked as
uninteresting by the caller.

We did not have the same problem on commits, because we make a
similar call to mark-parents-uninteresting but the function does not
care if the commit itself is already marked as uninteresting.

The distinction does not matter when tags are not involved.  But
once we start propagating the flags from a tag to objects that the
tag points at, it starts to matter.  The caller will mark the object
uninteresting in the loop that peels the tag, and the resulting
object is uninteresting.  It is not a problem for commits.  It was a
problem for trees, which used mark_tree_uninteresting() to mark all
the objects inside the tree uninteresting, including the tree itself.