Skip to content

Commit

Permalink
demonstrate breakage of detached checkout with symbolic link HEAD
Browse files Browse the repository at this point in the history
When core.prefersymlinkrefs is in use, detaching the HEAD by
checkout incorrectly clobbers the tip of the current branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Oct 19, 2008
1 parent 51a94af commit f563754
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions t/t7201-co.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,18 @@ test_expect_success 'checkout w/--track from non-branch HEAD fails' '
test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
'

test_expect_failure 'detach a symbolic link HEAD' '
git checkout master &&
git config --bool core.prefersymlinkrefs yes &&
git checkout side &&
git checkout master &&
it=$(git symbolic-ref HEAD) &&
test "z$it" = zrefs/heads/master &&
here=$(git rev-parse --verify refs/heads/master) &&
git checkout side^ &&
test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
'

test_expect_success 'checkout an unmerged path should fail' '
rm -f .git/index &&
O=$(echo original | git hash-object -w --stdin) &&
Expand Down

0 comments on commit f563754

Please sign in to comment.