worktree: allow the main brach of a bare repository to be checked out
In bare repositories, get_worktrees() still returns the main repository, so git worktree list can show it. ignore it in find_shared_symref so we can still check out the main branch. Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net> Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
74eeaf7b72
commit
171c646f8c
@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user