summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorOlga Pilipenco <olga.pilipenco@shopify.com>2025-02-05 06:30:13 +0000
committerJunio C Hamano <gitster@pobox.com>2025-02-05 09:46:23 -0800
commit78a95e0d806677fbb1d436c2985e39c1f8ce3c00 (patch)
tree028f426bfb079fe9368ab1b05f487ced77774c45 /commit.c
parent58b5801aa94ad5031978f8e42c1be1230b3d352f (diff)
worktree: detect from secondary worktree if main worktree is bare
When extensions.worktreeConfig is true and the main worktree is bare -- that is, its config.worktree file contains core.bare=true -- commands run from secondary worktrees incorrectly see the main worktree as not bare. As such, those commands incorrectly think that the repository's default branch (typically "main" or "master") is checked out in the bare repository even though it's not. This makes it impossible, for instance, to checkout or delete the default branch from a secondary worktree, among other shortcomings. This problem occurs because, when extensions.worktreeConfig is true, commands run in secondary worktrees only consult $commondir/config and $commondir/worktrees/<id>/config.worktree, thus they never see the main worktree's core.bare=true setting in $commondir/config.worktree. Fix this problem by consulting the main worktree's config.worktree file when checking whether it is bare. (This extra work is performed only when running from a secondary worktree.) Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Olga Pilipenco <olga.pilipenco@shopify.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions