aboutsummaryrefslogtreecommitdiffstats
path: root/path.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-13 11:13:31 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-13 10:01:01 -0700
commit78f2210b3c8605144d62a90b58e888312f64efc8 (patch)
treeaa927ec5288bffdbe235a1f13bb04435a0fd8b01 /path.c
parenthooks: remove implicit dependency on `the_repository` (diff)
downloadgit-78f2210b3c8605144d62a90b58e888312f64efc8.tar.gz
git-78f2210b3c8605144d62a90b58e888312f64efc8.zip
path: stop relying on `the_repository` when reporting garbage
We access `the_repository` in `report_linked_checkout_garbage()` both directly and indirectly via `get_git_dir()`. Remove this dependency by instead passing a `struct repository` as parameter. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/path.c b/path.c
index 069db6ff8f..97a07fafc7 100644
--- a/path.c
+++ b/path.c
@@ -365,15 +365,15 @@ static void update_common_dir(struct strbuf *buf, int git_dir_len,
strbuf_addstr(buf, LOCK_SUFFIX);
}
-void report_linked_checkout_garbage(void)
+void report_linked_checkout_garbage(struct repository *r)
{
struct strbuf sb = STRBUF_INIT;
const struct common_dir *p;
int len;
- if (!the_repository->different_commondir)
+ if (!r->different_commondir)
return;
- strbuf_addf(&sb, "%s/", get_git_dir());
+ strbuf_addf(&sb, "%s/", r->gitdir);
len = sb.len;
for (p = common_list; p->path; p++) {
const char *path = p->path;