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

Re: [PATCHSET] git-reverse-trailer-xrefs: Reverse map cherry-picks and other cross-references

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 13, 2018, 05:47 UTC
Message-ID
<xmqqftv2f05j.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181213034041.GR2509588@devbig004.ftw2.facebook.com>
Tejun Heo <tj@kernel.org> writes:
> Hmmm... I see.  I still have a bit of trouble seeing why doing it that
> way is better tho.  Wouldn't new-object-hook be simpler?  They'll
> achieve about the same thing but one would need to keep the states in
> two places.

The new-object-hook thing will not have keep the states. Whenever Git realizes that it created a new object, it must call that hook, and at that point in time, without keeping any state, it knows which objects are what it has just created. So "in two places" is not a problem at all. There is only one place (i.e. the place the sweeper would record what it just did to communicate with its future invocation).

A new-object-hook that will always be called any time a new object enters the picture would be a nightmare to maintain up-to-date. One missed codepath and your coverage will have holes. Having a back-up mechanism to sweep for new objects will give you a better chance of staying correct as the system evolves, I'd think.

Previous: Tejun HeoNext: Tejun Heo
Message 16 of 17 in “[PATCHSET] git-reverse-trailer-xrefs: Reverse map cherry-picks and other cross-references”
  1. Tejun HeoDec 11, 2018
  2. 1/5 trailer: Implement a helper to reverse-map trailer xrefsTejun Heo, Dec 11, 2018
  3. 2/5 notes: Implement special handlings for refs/notes/xref-Tejun Heo, Dec 11, 2018
  4. 3/5 notes: Implement git-reverse-trailer-xrefsTejun Heo, Dec 11, 2018
  5. 4/5 githooks: Add post-cherry-pick and post-fetch hooksTejun Heo, Dec 11, 2018
  6. 5/5 notes: Implement xref-cherry-picks hooks and testsTejun Heo, Dec 11, 2018
  7. Junio C HamanoDec 12, 2018
  8. Tejun HeoDec 12, 2018
  9. Junio C HamanoDec 13, 2018
  10. Junio C HamanoDec 13, 2018
  11. Tejun HeoDec 13, 2018
  12. Stefan XenosDec 18, 2018
  13. Stefan XenosDec 18, 2018
  14. Tejun HeoDec 18, 2018
  15. Tejun HeoDec 13, 2018
  16. Junio C HamanoDec 13, 2018
  17. Tejun HeoDec 13, 2018

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.