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

Re: [PATCH 0/5] refs: remove functions without ref store

From
Patrick Steinhardt <ps@pks.im>
Date
May 6, 2024, 06:44 UTC
Message-ID
<Zjh8XWwJKp_I1dwE@tanuki>
In-Reply-To
<xmqq7cga7nzo.fsf@gitster.g>
On Fri, May 03, 2024 at 11:24:11AM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Though maybe an even more radical proposal: now that read_ref_full(),
> > etc, are gone, and we have only refs_read_ref_full(), could/should we
> > shorten the latter to drop the "refs_" prefix?
> 
> I view it as a good longer-term goal.  But I also view it as an
> orthogonal issue to the transition.

Personally, I'd prefer to keep the `refs_` prefix. This may be personal preference, but I find it way easier to reason about code when there are prefixes for our functions that clearly indicate the subsystem they belong to.

It's also in line with how other subsystems behave. Everything relating to strbufs has a `strbuf_` prefix, attr-related code has `attr_` or `git_attr_`, mem-pool has `mem_pool_`. So ref-related code having a `ref_` prefix just feels natural to me.

> We need a smooth migration path for remaining callers of these older
> functions.  We could do the USE_THE_INDEX_MACROS like compatibility
> layer during transition period.

Wouldn't this be overengineered? We already have all the required functions. So my take would be to drop the last patch for now, wait a release cycle, and then remove it in the next one.

The only problem is that this allows in-flight patch series to introduce _new_ callers. So we're basically working against a moving target in that case. That is something that would be addressed by having something like your proposed `USE_THE_INDEX_MACROS` macro. But honestly, I doubt that it would be faster for any author of a patch series to figure out that they now need to a define something compared to just adding the `refs_` prefix to their functions.

Patrick
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 32 in “refs: remove functions without ref store”
  1. 0/5 refs: remove functions without ref storePatrick Steinhardt, May 3, 2024
  2. 1/5 refs: introduce missing functions that accept a `struct ref_store`Patrick Steinhardt, May 3, 2024
  3. Junio C HamanoMay 3, 2024
  4. 2/5 refs: add `exclude_patterns` parameter to `for_each_fullref_in()`Patrick Steinhardt, May 3, 2024
  5. Taylor BlauMay 3, 2024
  6. 3/5 cocci: introduce rules to transform "refs" to pass ref storePatrick Steinhardt, May 3, 2024
  7. 4/5 cocci: apply rules to rewrite callers of "refs" interfacesPatrick Steinhardt, May 3, 2024
  8. Taylor BlauMay 3, 2024
  9. Junio C HamanoMay 3, 2024
  10. Patrick SteinhardtMay 6, 2024
  11. 5/5 refs: remove functions without ref storePatrick Steinhardt, May 3, 2024
  12. James LiuMay 6, 2024
  13. Junio C HamanoMay 3, 2024
  14. Jeff KingMay 3, 2024
  15. Junio C HamanoMay 3, 2024
  16. Patrick SteinhardtMay 6, 2024
  17. Junio C HamanoMay 6, 2024
  18. Patrick SteinhardtMay 7, 2024
  19. Junio C HamanoMay 7, 2024
  20. Patrick SteinhardtMay 7, 2024
  21. Junio C HamanoMay 7, 2024
  22. Jeff KingMay 9, 2024
  23. Patrick SteinhardtMay 10, 2024
  24. Taylor BlauMay 3, 2024
  25. Junio C HamanoMay 3, 2024
  26. 0/5 refs: remove functions without ref storePatrick Steinhardt, May 7, 2024
  27. 1/5 refs: introduce missing functions that accept a `struct ref_store`Patrick Steinhardt, May 7, 2024
  28. 2/5 refs: add `exclude_patterns` parameter to `for_each_fullref_in()`Patrick Steinhardt, May 7, 2024
  29. 3/5 cocci: introduce rules to transform "refs" to pass ref storePatrick Steinhardt, May 7, 2024
  30. 4/5 cocci: apply rules to rewrite callers of "refs" interfacesPatrick Steinhardt, May 7, 2024
  31. 5/5 refs: remove functions without ref storePatrick Steinhardt, May 7, 2024
  32. Taylor BlauMay 7, 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.