MCPcopy Index your code
hub / github.com/git/git / ref_store_init

Function ref_store_init

refs.c:2321–2344  ·  view source on GitHub ↗

* Create, record, and return a ref_store instance for the specified * gitdir using the given ref storage format. */

Source from the content-addressed store, hash-verified

2319 * gitdir using the given ref storage format.
2320 */
2321static struct ref_store *ref_store_init(struct repository *repo,
2322 enum ref_storage_format format,
2323 const char *gitdir,
2324 unsigned int flags)
2325{
2326 const struct ref_storage_be *be;
2327 struct ref_store *refs;
2328 struct ref_store_init_options opts = {
2329 .access_flags = flags,
2330 .log_all_ref_updates = repo_settings_get_log_all_ref_updates(repo),
2331 };
2332
2333 be = find_ref_storage_backend(format);
2334 if (!be)
2335 BUG("reference backend is unknown");
2336
2337 /*
2338 * TODO Send in a 'struct worktree' instead of a 'gitdir', and
2339 * allow the backend to handle how it wants to deal with worktrees.
2340 */
2341 refs = be->init(repo, repo->ref_storage_payload, gitdir, &opts);
2342
2343 return refs;
2344}
2345
2346void ref_store_release(struct ref_store *ref_store)
2347{

Callers 4

get_main_ref_storeFunction · 0.85
get_worktree_ref_storeFunction · 0.85

Tested by

no test coverage detected