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

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

From
Glen Choo <chooglen@google.com>
Date
Nov 11, 2021, 17:16 UTC
Message-ID
<20211111171643.13805-1-chooglen@google.com>

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/20211028183101.41013-1-chooglen@google.com/
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(-)
-- 
2.33.GIT
Next: Glen Choo
Message 1 of 7 in “make create_branch() accept any repository”
  1. 0/3 make create_branch() accept any repositoryGlen Choo, Nov 11, 2021
  2. 1/3 refs/files-backend: remove the_repositoryGlen Choo, Nov 11, 2021
  3. 2/3 config: introduce repo_config_set* functionsGlen Choo, Nov 11, 2021
  4. Junio C HamanoNov 11, 2021
  5. Glen ChooNov 12, 2021
  6. Glen ChooNov 15, 2021
  7. 3/3 branch: remove implicit the_repository from create_branch()Glen Choo, Nov 11, 2021

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.