Currently, the receive.denyCurrentBranch config setting determines what Git should do when pushing a branch into a non-bare repository when said branch is checked out.
However, this setting was forgotten when the git worktree command was introduced: only the main worktree's current branch is respected.
For interested first contributors: use git grep -i receive.denycurrentbranch and follow the trail to find the code locations where that config setting modifies behavior. Then look for the code that prevents branches to be checked out in a worktree when they are already checked out in another worktree (git grep "is already checked out at" will lead you there). Then imitate that, to address this issue. (And throw in a test case or two, imitating the test cases in t/ that already test that config setting.)
Currently, the
receive.denyCurrentBranchconfig setting determines what Git should do when pushing a branch into a non-bare repository when said branch is checked out.However, this setting was forgotten when the
git worktreecommand was introduced: only the main worktree's current branch is respected.For interested first contributors: use
git grep -i receive.denycurrentbranchand follow the trail to find the code locations where that config setting modifies behavior. Then look for the code that prevents branches to be checked out in a worktree when they are already checked out in another worktree (git grep "is already checked out at"will lead you there). Then imitate that, to address this issue. (And throw in a test case or two, imitating the test cases int/that already test that config setting.)