summaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2023-03-28 13:58:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-03-28 14:36:46 (GMT)
commit4a93b899c19794c28b140bf78a13fb9c2b34f433 (patch)
treeba8e48e3f695c614cb959e75edf8bc7ae5eadbe2 /branch.c
parentc7c33f50bd1bb168a8c69157a0735ded84084f20 (diff)
downloadgit-4a93b899c19794c28b140bf78a13fb9c2b34f433.zip
git-4a93b899c19794c28b140bf78a13fb9c2b34f433.tar.gz
git-4a93b899c19794c28b140bf78a13fb9c2b34f433.tar.bz2
libs: use "struct repository *" argument, not "the_repository"
As can easily be seen from grepping in our sources, we had these uses of "the_repository" in various library code in cases where the function in question was already getting a "struct repository *" argument. Let's use that argument instead. Out of these changes only the changes to "cache-tree.c", "commit-reach.c", "shallow.c" and "upload-pack.c" would have cleanly applied before the migration away from the "repo_*()" wrapper macros in the preceding commits. The rest aren't new, as we'd previously implicitly refer to "the_repository", but it's now more obvious that we were doing the wrong thing all along, and should have used the parameter instead. The change to change "get_index_format_default(the_repository)" in "read-cache.c" to use the "r" variable instead should arguably have been part of [1], or in the subsequent cleanup in [2]. Let's do it here, as can be seen from the initial code in [3] it's not important that we use "the_repository" there, but would prefer to always use the current repository. This change excludes the "the_repository" use in "upload-pack.c"'s upload_pack_advertise(), as the in-flight [4] makes that change. 1. ee1f0c242ef (read-cache: add index.skipHash config option, 2023-01-06) 2. 6269f8eaad0 (treewide: always have a valid "index_state.repo" member, 2023-01-17) 3. 7211b9e7534 (repo-settings: consolidate some config settings, 2019-08-13) 4. <Y/hbUsGPVNAxTdmS@coredump.intra.peff.net> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/branch.c b/branch.c
index a01e465..2b266e6 100644
--- a/branch.c
+++ b/branch.c
@@ -531,7 +531,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
explicit_tracking = 1;
real_ref = NULL;
- if (repo_get_oid_mb(the_repository, start_name, &oid)) {
+ if (repo_get_oid_mb(r, start_name, &oid)) {
if (explicit_tracking) {
int code = die_message(_(upstream_missing), start_name);
advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,
@@ -541,8 +541,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
die(_("not a valid object name: '%s'"), start_name);
}
- switch (repo_dwim_ref(the_repository, start_name, strlen(start_name),
- &oid, &real_ref, 0)) {
+ switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,
+ &real_ref, 0)) {
case 0:
/* Not branching from any existing branch */
if (explicit_tracking)
@@ -773,7 +773,7 @@ void create_branches_recursively(struct repository *r, const char *name,
name);
}
- create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,
+ create_branch(r, name, start_commitish, force, 0, reflog, quiet,
BRANCH_TRACK_NEVER, dry_run);
if (dry_run)
return;