Re: [PATCH v3 23/25] checkout: detach if the branch is already checked out elsewhere
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 9 quoted lines
> 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 <pclouds@gmail.com>
(Only nitpicks during this round of review).
Show 17 quoted lines
> 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 &&