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:
authorHan-Wen Nienhuys <hanwen@google.com>2021-12-22 21:11:52 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-23 00:51:37 +0300
commit99f0d97b736e80fb2f92f8a1a5fbc65b68c2a1b9 (patch)
tree5ec03c9d6afdc540ccc68de2bf56bc54cbb3098c /refs/packed-backend.c
parent597af311a2899bfd6640b9b107622c5795d5f998 (diff)
refs: pass gitdir to packed_ref_store_create
This is consistent with the calling convention for ref backend creation, and avoids storing ".git/packed-refs" (the name of a regular file) in a variable called ref_store::gitdir. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/packed-backend.c')
-rw-r--r--refs/packed-backend.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 67152c664e..caa1957252 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -194,20 +194,21 @@ static int release_snapshot(struct snapshot *snapshot)
}
struct ref_store *packed_ref_store_create(struct repository *repo,
- const char *path,
+ const char *gitdir,
unsigned int store_flags)
{
struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
struct ref_store *ref_store = (struct ref_store *)refs;
+ struct strbuf sb = STRBUF_INIT;
base_ref_store_init(ref_store, &refs_be_packed);
ref_store->repo = repo;
- ref_store->gitdir = xstrdup(path);
+ ref_store->gitdir = xstrdup(gitdir);
refs->store_flags = store_flags;
+ strbuf_addf(&sb, "%s/packed-refs", gitdir);
+ refs->path = strbuf_detach(&sb, NULL);
- refs->path = xstrdup(path);
chdir_notify_reparent("packed-refs", &refs->path);
-
return ref_store;
}