git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glen Choo <chooglen@google.com>
To: git@vger.kernel.org
Cc: Glen Choo <chooglen@google.com>
Subject: [PATCH v1 0/3] make create_branch() accept any repository
Date: Thu, 11 Nov 2021 09:16:40 -0800	[thread overview]
Message-ID: <20211111171643.13805-1-chooglen@google.com> (raw)

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


             reply	other threads:[~2021-11-11 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 17:16 Glen Choo [this message]
2021-11-11 17:16 ` [PATCH v1 1/3] refs/files-backend: remove the_repository Glen Choo
2021-11-11 17:16 ` [PATCH v1 2/3] config: introduce repo_config_set* functions Glen Choo
2021-11-11 20:24   ` Junio C Hamano
2021-11-12  0:45     ` Glen Choo
2021-11-15 22:17       ` Glen Choo
2021-11-11 17:16 ` [PATCH v1 3/3] branch: remove implicit the_repository from create_branch() Glen Choo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211111171643.13805-1-chooglen@google.com \
    --to=chooglen@google.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).