Merge branch 'ps/worktree-refdb-initialization'

Instead of manually creating refs/ hierarchy on disk upon a
creation of a secondary worktree, which is only usable via the
files backend, use the refs API to populate it.

* ps/worktree-refdb-initialization:
  builtin/worktree: create refdb via ref backend
  worktree: expose interface to look up worktree by name
  builtin/worktree: move setup of commondir file earlier
  refs/files: skip creation of "refs/{heads,tags}" for worktrees
  setup: move creation of "refs/" into the files backend
  refs: prepare `refs_init_db()` for initializing worktree refs
This commit is contained in:
Junio C Hamano
2024-01-26 08:54:46 -08:00
10 changed files with 96 additions and 69 deletions

6
refs.c
View File

@ -1997,11 +1997,9 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
}
/* backend functions */
int refs_init_db(struct strbuf *err)
int refs_init_db(struct ref_store *refs, int flags, struct strbuf *err)
{
struct ref_store *refs = get_main_ref_store(the_repository);
return refs->be->init_db(refs, err);
return refs->be->init_db(refs, flags, err);
}
const char *resolve_ref_unsafe(const char *refname, int resolve_flags,