Subject: Re: [PATCH v3 23/25] checkout: detach if the branch is already checked out elsewhere

From: Junio C Hamano <[email-masked]>
Date: Wed, 19 Feb 2014 12:20:36 -0800

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> The normal rule is anything outside refs/heads/ is detached. This
> strictens 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 <[email-masked]>

(Only nitpicks during this round of review).

> diff --git a/t/t2025-checkout-to.sh b/t/t2025-checkout-to.sh
> index 76eae4a..f6a5c47 100755
> --- a/t/t2025-checkout-to.sh
> +++ b/t/t2025-checkout-to.sh
> @@ -13,13 +13,14 @@ test_expect_success 'checkout --to not updating paths' '
>  '
>  
>  test_expect_success 'checkout --to a new worktree' '
> +	git rev-parse HEAD >expect &&
>  	git checkout --to here master &&
>  	(
>  		cd here &&
>  		test_cmp ../init.t init.t &&
> -		git symbolic-ref HEAD >actual &&
> -		echo refs/heads/master >expect &&
> -		test_cmp expect actual &&
> +		! git symbolic-ref HEAD &&

test_must_fail?