| 430 | } |
| 431 | |
| 432 | static 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 | |
| 462 | static int read_ref_internal(struct ref_store *ref_store, const char *refname, |
| 463 | struct object_id *oid, struct strbuf *referent, |
no test coverage detected