summaryrefslogtreecommitdiff
path: root/t/t2025-worktree-add.sh
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-07-17 23:00:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-20 18:29:24 (GMT)
commit746bbdc64f1e1b2618cd71e5da81e38aa772e8ba (patch)
tree0dcdbcb719ba305fdaaca9aa6a844380a2370def /t/t2025-worktree-add.sh
parent33aef83666900df03c39bcf7e391e2f8195dd13c (diff)
downloadgit-746bbdc64f1e1b2618cd71e5da81e38aa772e8ba.zip
git-746bbdc64f1e1b2618cd71e5da81e38aa772e8ba.tar.gz
git-746bbdc64f1e1b2618cd71e5da81e38aa772e8ba.tar.bz2
checkout: teach check_linked_checkout() about symbolic link HEAD
check_linked_checkout() only understands symref-style HEAD (i.e. "ref: refs/heads/master"), however, HEAD may also be a an actual symbolic link (on platforms which support it). To accurately detect if a branch is checked out elsewhere, it needs to handle symbolic link HEAD, as well. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2025-worktree-add.sh')
-rwxr-xr-xt/t2025-worktree-add.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
index ead8aa2..9e30690 100755
--- a/t/t2025-worktree-add.sh
+++ b/t/t2025-worktree-add.sh
@@ -83,6 +83,14 @@ test_expect_success 'die the same branch is already checked out' '
)
'
+test_expect_success SYMLINKS 'die the same branch is already checked out (symlink)' '
+ head=$(git -C there rev-parse --git-path HEAD) &&
+ ref=$(git -C there symbolic-ref HEAD) &&
+ rm "$head" &&
+ ln -s "$ref" "$head" &&
+ test_must_fail git -C here checkout newmaster
+'
+
test_expect_success 'not die the same branch is already checked out' '
(
cd here &&