From 2eb1d0c45271faf149a13b61bb74af52abd7b3aa Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 8 Jan 2024 11:05:35 +0100 Subject: refs/files: skip creation of "refs/{heads,tags}" for worktrees The files ref backend will create both "refs/heads" and "refs/tags" in the Git directory. While this logic makes sense for normal repositories, it does not for worktrees because those refs are "common" refs that would always be contained in the main repository's ref database. Introduce a new flag telling the backend that it is expected to create a per-worktree ref database and skip creation of these dirs in the files backend when the flag is set. No other backends (currently) need worktree-specific logic, so this is the only required change to start creating per-worktree ref databases via `refs_init_db()`. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- refs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'refs.h') diff --git a/refs.h b/refs.h index 114caa272a..c2dfe451a1 100644 --- a/refs.h +++ b/refs.h @@ -126,6 +126,8 @@ int should_autocreate_reflog(const char *refname); int is_branch(const char *refname); +#define REFS_INIT_DB_IS_WORKTREE (1 << 0) + int refs_init_db(struct ref_store *refs, int flags, struct strbuf *err); /* -- cgit v1.2.3