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

Function get_loose_ref_cache

refs/files-backend.c:432–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs,
433 unsigned int flags)
434{
435 if (!refs->loose) {
436 struct ref_dir *dir;
437
438 /*
439 * Mark the top-level directory complete because we
440 * are about to read the only subdirectory that can
441 * hold references:
442 */
443 refs->loose = create_ref_cache(&refs->base, loose_fill_ref_dir);
444
445 /* We're going to fill the top level ourselves: */
446 refs->loose->root->flag &= ~REF_INCOMPLETE;
447
448 dir = get_ref_dir(refs->loose->root);
449
450 if (flags & REFS_FOR_EACH_INCLUDE_ROOT_REFS)
451 add_root_refs(refs, dir);
452
453 /*
454 * Add an incomplete entry for "refs/" (to be filled
455 * lazily):
456 */
457 add_entry_to_dir(dir, create_dir_entry(refs->loose, "refs/", 5));
458 }
459 return refs->loose;
460}
461
462static int read_ref_internal(struct ref_store *ref_store, const char *refname,
463 struct object_id *oid, struct strbuf *referent,

Callers 3

files_ref_iterator_beginFunction · 0.85
should_pack_refsFunction · 0.85
files_optimizeFunction · 0.85

Calls 5

create_ref_cacheFunction · 0.85
get_ref_dirFunction · 0.85
add_root_refsFunction · 0.85
add_entry_to_dirFunction · 0.85
create_dir_entryFunction · 0.85

Tested by

no test coverage detected