aboutsummaryrefslogtreecommitdiffstats
path: root/refs.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-01-08 11:05:35 +0100
committerJunio C Hamano <gitster@pobox.com>2024-01-08 13:17:30 -0800
commit2eb1d0c45271faf149a13b61bb74af52abd7b3aa (patch)
treed1e19a1d3f8066a0e0ae0f6ba66a91d1ff062444 /refs.h
parentc358d165f2a4b3176b527e18c207105f6821335e (diff)
downloadgit-2eb1d0c45271faf149a13b61bb74af52abd7b3aa.tar.gz
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h2
1 files changed, 2 insertions, 0 deletions
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);
/*