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

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

From
Patrick Steinhardt <ps@pks.im>
Date
May 3, 2024, 06:27 UTC
Message-ID
<cover.1714717057.git.ps@pks.im>
Hi,

this patch series aims to convert the ref subsystem to rely less on `the_repository`. The focus of it is to remove those cases where we have two variants of the same function: one with a `struct ref_store`, and one without. There are still other cases in "refs.c" where we implicitly assume `the_repository`, but those require a bit more thought and will thus be handled in a subsequent patch series.

The biggest part of this patch is a set of new Coccinelle rules added by patch 3. Those rules are applied in patch 4 and the now-unused functions that do not take a `struct ref_store` are then removed in patch 5. This of course results in quite a lot of churn, but given that it is fully automated via Coccinelle I don't think it is particularly bad.

It is quite likely that this patch series will impact in-flight patch series. I'd be quite happy to drop the last patch that removes the old interfaces to make this a bit less painful.

Patrick
Patrick Steinhardt (5):
  refs: introduce missing functions that accept a `struct ref_store`
  refs: add `exclude_patterns` parameter to `for_each_fullref_in()`
  cocci: introduce rules to transform "refs" to pass ref store
  cocci: apply rules to rewrite callers of "refs" interfaces
  refs: remove functions without ref store
 add-interactive.c             |  17 ++-
 bisect.c                      |  25 +++--
 blame.c                       |   4 +-
 branch.c                      |   5 +-
 builtin/am.c                  |  38 ++++---
 builtin/bisect.c              |  44 +++++---
 builtin/blame.c               |   4 +-
 builtin/branch.c              |  49 +++++----
 builtin/checkout.c            |  35 +++---
 builtin/clone.c               |  36 +++---
 builtin/describe.c            |   3 +-
 builtin/fast-import.c         |  11 +-
 builtin/fetch.c               |  20 +++-
 builtin/fsck.c                |  11 +-
 builtin/gc.c                  |   3 +-
 builtin/log.c                 |   6 +-
 builtin/merge.c               |  34 ++++--
 builtin/name-rev.c            |   5 +-
 builtin/notes.c               |  26 +++--
 builtin/pack-objects.c        |  10 +-
 builtin/pull.c                |   2 +-
 builtin/rebase.c              |  18 +--
 builtin/receive-pack.c        |  15 ++-
 builtin/reflog.c              |  25 +++--
 builtin/remote.c              |  37 ++++---
 builtin/repack.c              |   7 +-
 builtin/replace.c             |   9 +-
 builtin/reset.c               |  13 ++-
 builtin/rev-parse.c           |  25 +++--
 builtin/show-branch.c         |  22 ++--
 builtin/show-ref.c            |  19 +++-
 builtin/stash.c               |  23 ++--
 builtin/submodule--helper.c   |   7 +-
 builtin/symbolic-ref.c        |  13 ++-
 builtin/tag.c                 |  11 +-
 builtin/update-index.c        |   2 +-
 builtin/update-ref.c          |  21 ++--
 builtin/worktree.c            |  19 ++--
 bundle-uri.c                  |  12 +-
 bundle.c                      |   2 +-
 commit-graph.c                |   3 +-
 commit.c                      |   3 +-
 config.c                      |   3 +-
 contrib/coccinelle/refs.cocci | 103 +++++++++++++++++
 delta-islands.c               |   3 +-
 fetch-pack.c                  |   6 +-
 fmt-merge-msg.c               |   4 +-
 help.c                        |   5 +-
 http-backend.c                |  13 ++-
 log-tree.c                    |   9 +-
 ls-refs.c                     |  10 +-
 midx-write.c                  |   3 +-
 negotiator/default.c          |   3 +-
 negotiator/skipping.c         |   3 +-
 notes-cache.c                 |   6 +-
 notes-merge.c                 |   2 +-
 notes-utils.c                 |   7 +-
 notes.c                       |   5 +-
 reachable.c                   |   5 +-
 ref-filter.c                  |  35 ++++--
 reflog-walk.c                 |  27 +++--
 reflog.c                      |  20 ++--
 refs.c                        | 200 ++++------------------------------
 refs.h                        |  84 +++-----------
 remote.c                      |  38 ++++---
 reset.c                       |  29 +++--
 revision.c                    |  27 +++--
 sequencer.c                   |  61 ++++++-----
 server-info.c                 |   3 +-
 setup.c                       |   2 +-
 shallow.c                     |  16 ++-
 submodule.c                   |   6 +-
 transport-helper.c            |  29 +++--
 transport.c                   |  16 ++-
 upload-pack.c                 |  20 ++--
 walker.c                      |   6 +-
 wt-status.c                   |  22 ++--
 77 files changed, 845 insertions(+), 680 deletions(-)
 create mode 100644 contrib/coccinelle/refs.cocci
-- 
2.45.0
Next: Patrick Steinhardt
Message 1 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.