Merge branch 'dk/worktree-dup-checkout-with-bare-is-ok'
In a worktree connected to a repository elsewhere, created via "git worktree", "git checkout" attempts to protect users from confusion by refusing to check out a branch that is already checked out in another worktree. However, this also prevented checking out a branch, which is designated as the primary branch of a bare reopsitory, in a worktree that is connected to the bare repository. The check has been corrected to allow it. * dk/worktree-dup-checkout-with-bare-is-ok: worktree: allow the main brach of a bare repository to be checked out
This commit is contained in:
commit
8e83d05315
@ -138,6 +138,14 @@ test_expect_success 'checkout from a bare repo without "add"' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success '"add" default branch of a bare repo' '
|
||||
(
|
||||
git clone --bare . bare2 &&
|
||||
cd bare2 &&
|
||||
git worktree add ../there3 master
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'checkout with grafts' '
|
||||
test_when_finished rm .git/info/grafts &&
|
||||
test_commit abc &&
|
||||
|
@ -345,6 +345,8 @@ const struct worktree *find_shared_symref(const char *symref,
|
||||
|
||||
for (i = 0; worktrees[i]; i++) {
|
||||
struct worktree *wt = worktrees[i];
|
||||
if (wt->is_bare)
|
||||
continue;
|
||||
|
||||
if (wt->is_detached && !strcmp(symref, "HEAD")) {
|
||||
if (is_worktree_being_rebased(wt, target)) {
|
||||
|
Loading…
Reference in New Issue
Block a user