git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: revision: propagate flag bits from tags to pointees

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2014, 22:25 UTC
Message-ID
<xmqqk3e0288d.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140115215641.GB16401@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 26 quoted lines
> Looks good to me. As per my previous mail, I _think_ you could squash
> in:
>
> diff --git a/revision.c b/revision.c
> index f786b51..2db906c 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -316,13 +316,10 @@ static struct commit *handle_commit(struct rev_info *revs,
>  	 * Blob object? You know the drill by now..
>  	 */
>  	if (object->type == OBJ_BLOB) {
> -		struct blob *blob = (struct blob *)object;
>  		if (!revs->blob_objects)
>  			return NULL;
> -		if (flags & UNINTERESTING) {
> -			mark_blob_uninteresting(blob);
> +		if (flags & UNINTERESTING)
>  			return NULL;
> -		}
>  		add_pending_object(revs, object, "");
>  		return NULL;
>  	}
>
> but that is not very much code reduction (and mark_blob_uninteresting is
> very cheap). So it may not be worth the risk that my analysis is wrong.
> :)

Your analysis is correct, but I think the pros-and-cons of the your squashable change boils down to the choice between:

 - leaving it in will keep similarity between tree and blob
   codepaths (both have mark_X_uninteresting(); and
 - reducing cycles by taking advantage of the explicit knowledge
   that mark_X_uninteresting() recurses for a tree while it does not
   for a blob.

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?

Previous: Jeff KingNext: Junio C Hamano
Message 7 of 9 in “git-log --cherry-pick gives different results when using tag or tag^{}”
  1. Francis MoreauJan 10, 2014
  2. Jeff KingJan 15, 2014
  3. Francis MoreauJan 15, 2014
  4. Junio C HamanoJan 15, 2014
  5. revision: propagate flag bits from tags to pointeesJunio C Hamano, Jan 15, 2014
  6. Jeff KingJan 15, 2014
  7. Junio C HamanoJan 15, 2014
  8. Junio C HamanoJan 15, 2014
  9. Jeff KingJan 15, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.