checkout: detach if the branch is already checked out elsewhere
commitf879c05a2e9c070d068e74d54ae94f0fb31aa87a
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sun, 13 Jul 2014 04:51:01 +0000 (13 11:51 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jul 2014 18:05:42 +0000 (17 11:05 -0700)
tree5bb49074c34741fe1d21d38177ac834115fd867c
parent10535df8111ae85655e34a21fa0cee7d5fb3b657
checkout: detach if the branch is already checked out elsewhere

The normal rule is anything outside refs/heads/ is detached. This
increases strictness of the rule a bit more: if the branch is checked
out (either in $GIT_COMMON_DIR/HEAD or any $GIT_DIR/repos/.../HEAD)
then it's detached as well.

A hint is given so the user knows where to go and do something there
if they still want to checkout undetached here.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
t/t2025-checkout-to.sh