Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2023-03-28 16:58:58 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-28 17:36:46 +0300
commit4a93b899c19794c28b140bf78a13fb9c2b34f433 (patch)
treeba8e48e3f695c614cb959e75edf8bc7ae5eadbe2 /wt-status.c
parentc7c33f50bd1bb168a8c69157a0735ded84084f20 (diff)
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 'wt-status.c')
-rw-r--r--wt-status.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/wt-status.c b/wt-status.c
index dcd1d0cee4..28e35a2165 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1664,7 +1664,7 @@ static void wt_status_get_detached_from(struct repository *r,
return;
}
- if (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,
+ if (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref,
1) == 1 &&
/* oid is a commit? match without further lookup */
(oideq(&cb.noid, &oid) ||
@@ -1677,9 +1677,9 @@ static void wt_status_get_detached_from(struct repository *r,
state->detached_from = xstrdup(from);
} else
state->detached_from =
- xstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));
+ xstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV));
oidcpy(&state->detached_oid, &cb.noid);
- state->detached_at = !repo_get_oid(the_repository, "HEAD", &oid) &&
+ state->detached_at = !repo_get_oid(r, "HEAD", &oid) &&
oideq(&oid, &state->detached_oid);
free(ref);
@@ -1770,13 +1770,13 @@ void wt_status_get_state(struct repository *r,
} else if (wt_status_check_rebase(NULL, state)) {
; /* all set */
} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
- !repo_get_oid(the_repository, "CHERRY_PICK_HEAD", &oid)) {
+ !repo_get_oid(r, "CHERRY_PICK_HEAD", &oid)) {
state->cherry_pick_in_progress = 1;
oidcpy(&state->cherry_pick_head_oid, &oid);
}
wt_status_check_bisect(NULL, state);
if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
- !repo_get_oid(the_repository, "REVERT_HEAD", &oid)) {
+ !repo_get_oid(r, "REVERT_HEAD", &oid)) {
state->revert_in_progress = 1;
oidcpy(&state->revert_head_oid, &oid);
}