Skip to content

make create_branch() accept any repository

Glen Choo git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3refs/files-backend: remove the_repositoryrefs/files-backend.c+11 -90 replies
2/3config: introduce repo_config_set* functionsconfig.c config.h+35 -03 replies
3/3branch: remove implicit the_repository from create_branch()branch.c branch.h builtin/branch.c +1 more+61 -290 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] make create_branch() accept any repository

create_branch() accepts a struct repository parameter, which seems to suggest that it works with any repository, but it actually only works with the_repository. This series aims to fix this discrepancy.

This series depends on gc/remote-with-fewer-static-global-variables [1] because setup_tracking() needs tracking information from repositories other than the_repository.

Note that this fix is not as clean as "just replace the problematic functions with an equivalent that doesn't use the_repository".

* git_config_set() uses the_repository deep in its call chain. Patch 2 adds an alternative implementation instead of trying to fix the entire call chain.
* We cannot check if a non-the_repository is bare (yet). In patch 3, just die instead of trying to perform this check.

While this series isn't perfect, I think it is close enough to an "ideal" removal of the_repository that it is ready for review. My hope is to use this series to implement "git branch --recurse-submodules" in-process. If this series doesn't pass review, I'll implement the feature with child processes instead.

[1] https://lore.kernel.org/git/[email protected]/

Glen Choo (3):
refs/files-backend: remove the_repository
config: introduce repo_config_set* functions
branch: remove implicit the_repository from create_branch()

 branch.c             | 69 ++++++++++++++++++++++++++++++--------------
 branch.h             |  9 ++++--
 builtin/branch.c     |  5 ++--
 builtin/checkout.c   |  7 +++--
 config.c             | 24 +++++++++++++++
 config.h             | 11 +++++++
 refs/files-backend.c | 20 +++++++------
 7 files changed, 107 insertions(+), 38 deletions(-)
Signature · 1 line
2.33.GIT