Merge branch 'os/fetch-check-not-current-branch'

The way "git fetch" without "--update-head-ok" ensures that HEAD in
no worktree points at any ref being updated was too wasteful, which
has been optimized a bit.

* os/fetch-check-not-current-branch:
  fetch: limit shared symref check only for local branches
This commit is contained in:
Junio C Hamano 2022-05-25 16:42:48 -07:00
commit 5ed49a75f3

View File

@ -1440,6 +1440,7 @@ static void check_not_current_branch(struct ref *ref_map,
const struct worktree *wt;
for (; ref_map; ref_map = ref_map->next)
if (ref_map->peer_ref &&
starts_with(ref_map->peer_ref->name, "refs/heads/") &&
(wt = find_shared_symref(worktrees, "HEAD",
ref_map->peer_ref->name)) &&
!wt->is_bare)