aboutsummaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-26 08:54:46 -0800
committerJunio C Hamano <gitster@pobox.com>2024-01-26 08:54:46 -0800
commitdc8ce995a2ad203ffb5ef335682b64da955e645a (patch)
tree5fb18d234cc42148bbd37754477fded0bff1cca4 /setup.c
parentf95bafbaed2d9f9c891e04c3680c1aa0da30629e (diff)
parent8f4c00de954f809e83daf8b1425de82561f3721e (diff)
downloadgit-dc8ce995a2ad203ffb5ef335682b64da955e645a.tar.gz
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
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/setup.c b/setup.c
index b38702718f..f4ad53d545 100644
--- a/setup.c
+++ b/setup.c
@@ -1926,23 +1926,8 @@ void create_reference_database(unsigned int ref_storage_format,
struct strbuf err = STRBUF_INIT;
int reinit = is_reinit();
- /*
- * We need to create a "refs" dir in any case so that older versions of
- * Git can tell that this is a repository. This serves two main purposes:
- *
- * - Clients will know to stop walking the parent-directory chain when
- * detecting the Git repository. Otherwise they may end up detecting
- * a Git repository in a parent directory instead.
- *
- * - Instead of failing to detect a repository with unknown reference
- * format altogether, old clients will print an error saying that
- * they do not understand the reference format extension.
- */
- safe_create_dir(git_path("refs"), 1);
- adjust_shared_perm(git_path("refs"));
-
repo_set_ref_storage_format(the_repository, ref_storage_format);
- if (refs_init_db(&err))
+ if (refs_init_db(get_main_ref_store(the_repository), 0, &err))
die("failed to set up refs db: %s", err.buf);
/*