MCPcopy Create free account
hub / github.com/git/git / packed_ref_store_init

Function packed_ref_store_init

refs/packed-backend.c:218–234  ·  view source on GitHub ↗

* Since packed-refs is only stored in the common dir, don't parse the * payload and rely on the files-backend to set 'gitdir' correctly. */

Source from the content-addressed store, hash-verified

216 * payload and rely on the files-backend to set 'gitdir' correctly.
217 */
218struct ref_store *packed_ref_store_init(struct repository *repo,
219 const char *payload UNUSED,
220 const char *gitdir,
221 const struct ref_store_init_options *opts)
222{
223 struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
224 struct ref_store *ref_store = (struct ref_store *)refs;
225 struct strbuf sb = STRBUF_INIT;
226
227 base_ref_store_init(ref_store, repo, gitdir, &refs_be_packed);
228 refs->store_flags = opts->access_flags;
229
230 strbuf_addf(&sb, "%s/packed-refs", gitdir);
231 refs->path = strbuf_detach(&sb, NULL);
232 chdir_notify_reparent("packed-refs", &refs->path);
233 return ref_store;
234}
235
236/*
237 * Downcast `ref_store` to `packed_ref_store`. Die if `ref_store` is

Callers 1

files_ref_store_initFunction · 0.85

Calls 5

xcallocFunction · 0.85
base_ref_store_initFunction · 0.85
strbuf_addfFunction · 0.85
strbuf_detachFunction · 0.85
chdir_notify_reparentFunction · 0.85

Tested by

no test coverage detected