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

Re: [PATCH] ref-filter: handle nested tags in --points-at option

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 5, 2023, 17:16 UTC
Message-ID
<xmqqedlm2s9q.fsf@gitster.g>
In-Reply-To
<20230705124107.GA3932508@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> On Tue, Jul 04, 2023 at 11:10:47PM -0700, Junio C Hamano wrote:
>
>> My preference would be to see these optimization done first and then
>> add this new loop on top of it.  That way, we can measure more
>> easily what kind of additional overhead, if any, we are paying by
>> adding the loop.
>
> I ended up doing them on top, rather than before, but I think the size
> of the impact can easily be seen.

Ah, I should have first read (or at least skimmed) all messages before responding. Thanks for following through.

Show 5 quoted lines
> The one thing that would actually make us a lot faster (by using the
> packed-refs peels) is to make full peels the only option, and do not
> bother letting --points-at match "B" in an A->B->C peel. But that would
> be removing something that is currently matched (even before the patch
> in this thread), so I stopped short of it in my optimizations.

Interesting. Right now, if I create a 'direct' tag that points directly at HEAD, and then create an 'indirect' tag that points at 'direct', i.e.

    $ git tag -a -m 'a direct tag to HEAD' direct HEAD
    $ git tag -a -m 'an indirect tag' indirect direct

I would get a piece of advice message that encourages to correct the mistake with "git tag -f indirect direct^{}". Then I ask for tags that point at HEAD, I see only 'direct' and not 'indirect'. Your optimization would start showing both 'direct' and 'indirect' if they are packed. But you are correct to worry about the opposite case. If I ask for tags that point at 'direct', I currently see 'indirect', but of course 'indirect' will not appear as the peeled value of any ref, and the optimized version will stop saying that 'indirect' is a ref that points at 'direct'. That sounds like a regression.

Show 7 quoted lines
> But even
> if we decide to do that, Jan's patch is not making anything worse there
> (in fact, it is making it better, because it is matching "C" which we do
> not currently match).
> ...
> So I'd be inclined to proceed with the patches I sent earlier, and then
> if we choose to later refactor again to drop "B", we can.

We generally avoid taking away anything once we give it to users; once the patch under discussion goes in, there is no taking it back, i.e. the new _behaviour_ closes the door to certain optimizations.

I do not at all mind to see us decide and declare that it is a good thing to say that not just 'direct' but also 'indirect' points at HEAD, and that 'indirect' points at 'direct' and the patch under discussion makes the world a etter place, and we will not regret that decision. But the time to make such a decision is now, before we give a go-ahead to the patch.

Thanks.
Previous: Jeff KingNext: Jan Klötzke
Message 13 of 15 in “ref-filter: handle nested tags in --points-at option”
  1. ref-filter: handle nested tags in --points-at optionJan Klötzke, Jul 1, 2023
  2. Jeff KingJul 2, 2023
  3. René ScharfeJul 2, 2023
  4. Jeff KingJul 2, 2023
  5. Jeff KingJul 2, 2023
  6. 0/3 a few --points-at optimizations/cleanupsJeff King, Jul 2, 2023
  7. 1/3 ref-filter: avoid parsing tagged objects in match_points_at()Jeff King, Jul 2, 2023
  8. 2/3 ref-filter: avoid parsing non-tags in match_points_at()Jeff King, Jul 2, 2023
  9. 3/3 ref-filter: simplify return type of match_points_atJeff King, Jul 2, 2023
  10. Jan KlötzkeJul 3, 2023
  11. Junio C HamanoJul 5, 2023
  12. Jeff KingJul 5, 2023
  13. Junio C HamanoJul 5, 2023
  14. Jan KlötzkeJul 5, 2023
  15. Junio C HamanoJul 5, 2023

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.