]> git.ipfire.org Git - thirdparty/git.git/commit - refs.h
refs/files: skip creation of "refs/{heads,tags}" for worktrees
authorPatrick Steinhardt <ps@pks.im>
Mon, 8 Jan 2024 10:05:35 +0000 (11:05 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Jan 2024 21:17:30 +0000 (13:17 -0800)
commit2eb1d0c45271faf149a13b61bb74af52abd7b3aa
treed1e19a1d3f8066a0e0ae0f6ba66a91d1ff062444
parentc358d165f2a4b3176b527e18c207105f6821335e
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>
refs.h
refs/files-backend.c