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

Function get_worktree_ref_store

refs.c:2434–2464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2432}
2433
2434struct ref_store *get_worktree_ref_store(const struct worktree *wt)
2435{
2436 struct ref_store *refs;
2437 const char *id;
2438
2439 if (wt->is_current)
2440 return get_main_ref_store(wt->repo);
2441
2442 id = wt->id ? wt->id : "/";
2443 refs = lookup_ref_store_map(&wt->repo->worktree_ref_stores, id);
2444 if (refs)
2445 return refs;
2446
2447 if (wt->id) {
2448 struct strbuf common_path = STRBUF_INIT;
2449 repo_common_path_append(wt->repo, &common_path,
2450 "worktrees/%s", wt->id);
2451 refs = ref_store_init(wt->repo, wt->repo->ref_storage_format,
2452 common_path.buf, REF_STORE_ALL_CAPS);
2453 strbuf_release(&common_path);
2454 } else {
2455 refs = ref_store_init(wt->repo, wt->repo->ref_storage_format,
2456 wt->repo->commondir, REF_STORE_ALL_CAPS);
2457 }
2458
2459 if (refs)
2460 register_ref_store_map(&wt->repo->worktree_ref_stores,
2461 "worktree", refs, id);
2462
2463 return refs;
2464}
2465
2466void base_ref_store_init(struct ref_store *refs, struct repository *repo,
2467 const char *path, const struct ref_storage_be *be)

Callers 10

add_head_infoFunction · 0.85
is_shared_symrefFunction · 0.85
get_storeFunction · 0.85
cmd_reflog_expireFunction · 0.85
cmd_reflog_dropFunction · 0.85
add_worktreeFunction · 0.85
process_refsFunction · 0.85
cmd_refs_verifyFunction · 0.85

Calls 6

get_main_ref_storeFunction · 0.85
lookup_ref_store_mapFunction · 0.85
repo_common_path_appendFunction · 0.85
ref_store_initFunction · 0.85
strbuf_releaseFunction · 0.85
register_ref_store_mapFunction · 0.85

Tested by 1

get_storeFunction · 0.68