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

Re: [PATCH 1/4] refs: add referent parameter to refs_resolve_ref_unsafe

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 10, 2024, 07:29 UTC
Message-ID
<ZmarVcF5JjsZx0dl@tanuki>
In-Reply-To
<xmqqv82mkk15.fsf@gitster.g>
On Thu, Jun 06, 2024 at 11:23:18AM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > "John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
> >
> >>  29 files changed, 64 insertions(+), 52 deletions(-)
> >
> > Wow, the blast radius of this thing is rather big.  Among these
> > existing callers of refs_resolve_ref_unsafe(), how many of them
> > will benefit from being able to pass a non NULL parameter at the end
> > of the series, and more importantly, in the future to take advantage
> > of the new feature possibly with a separate series?
> > ...
> > That way, you do not have to touch those existing callers that will
> > never benefit from the new capability in the future.  You won't risk
> > conflicting with in flight topics semantically, either.
> 
> The same comment applies to [3/4], but I do not want to fix the Cc: header
> again, so I am replying to this message.

I wonder whether we can future-proof the code a bit more by introducing a struct that contains everything we want to pass to the callback function. That wouldn't fix the blast radius of this patch, but would mean that we can easily add additional fielids to that struct in the future without having to adapt any callers at all anymore.

Something like:
    struct ref_data {
        const char *refname;
        const struct object_id *oid;
        const char *referent;
        int flags;
    };

This would also allow us to get rid of this awful `peel_iterated_oid()` function that relies on global state in many places, as we can put the peeled OID into that structure, as well.

Patrick
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 44 in “keep track of unresolved value of symbolic-ref in ref iterators”
  1. 0/4 keep track of unresolved value of symbolic-ref in ref iteratorsJohn Cai via GitGitGadget, Jun 6, 2024
  2. 2/4 refs: keep track of unresolved reference value in iteratorsJohn Cai via GitGitGadget, Jun 6, 2024
  3. Jeff KingJun 11, 2024
  4. 1/4 refs: add referent parameter to refs_resolve_ref_unsafeJohn Cai via GitGitGadget, Jun 6, 2024
  5. Junio C HamanoJun 6, 2024
  6. Junio C HamanoJun 6, 2024
  7. John CaiJun 7, 2024
  8. Junio C HamanoJun 7, 2024
  9. Patrick SteinhardtJun 10, 2024
  10. Junio C HamanoJun 10, 2024
  11. John CaiJun 6, 2024
  12. Junio C HamanoJun 6, 2024
  13. Kristoffer HaugsbakkJun 28, 2024
  14. Junio C HamanoJun 28, 2024
  15. Linus ArverJun 30, 2024
  16. Junio C HamanoJun 30, 2024
  17. Jeff KingJun 11, 2024
  18. John CaiJul 30, 2024
  19. 4/4 ref-filter: populate symref from iteratorJohn Cai via GitGitGadget, Jun 6, 2024
  20. 3/4 refs: add referent to each_ref_fnJohn Cai via GitGitGadget, Jun 6, 2024
  21. 0/3 keep track of unresolved value of symbolic-ref in ref iteratorsJohn Cai via GitGitGadget, Aug 1, 2024
  22. 1/3 refs: keep track of unresolved reference value in iteratorsJohn Cai via GitGitGadget, Aug 1, 2024
  23. Junio C HamanoAug 1, 2024
  24. Patrick SteinhardtAug 5, 2024
  25. Junio C HamanoAug 5, 2024
  26. 3/3 ref-filter: populate symref from iteratorJohn Cai via GitGitGadget, Aug 1, 2024
  27. Junio C HamanoAug 1, 2024
  28. Junio C HamanoAug 1, 2024
  29. Junio C HamanoAug 1, 2024
  30. John CaiAug 6, 2024
  31. Junio C HamanoAug 6, 2024
  32. 2/3 refs: add referent to each_ref_fnJohn Cai via GitGitGadget, Aug 1, 2024
  33. 0/3 keep track of unresolved value of symbolic-ref in ref iteratorsJohn Cai via GitGitGadget, Aug 7, 2024
  34. 1/3 refs: keep track of unresolved reference value in iteratorsJohn Cai via GitGitGadget, Aug 7, 2024
  35. Junio C HamanoAug 7, 2024
  36. John CaiAug 8, 2024
  37. 2/3 refs: add referent to each_ref_fnJohn Cai via GitGitGadget, Aug 7, 2024
  38. 3/3 ref-filter: populate symref from iteratorJohn Cai via GitGitGadget, Aug 7, 2024
  39. 0/3 keep track of unresolved value of symbolic-ref in ref iteratorsJohn Cai via GitGitGadget, Aug 9, 2024
  40. 1/3 refs: keep track of unresolved reference value in iteratorsJohn Cai via GitGitGadget, Aug 9, 2024
  41. shejialuoNov 23, 2024
  42. 2/3 refs: add referent to each_ref_fnJohn Cai via GitGitGadget, Aug 9, 2024
  43. 3/3 ref-filter: populate symref from iteratorJohn Cai via GitGitGadget, Aug 9, 2024
  44. Junio C HamanoAug 9, 2024

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.