@matheusbsbs / matheus-bagliano / commits / f5637549a7
Fork 0

demonstrate breakage of detached checkout with symbolic link HEAD

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>

Junio C Hamano committed Oct 17, 2008 at 15:56 UTC f5637549a7eb93883839de01399418e10bf81768
1 file changed +12
t/t7201-co.sh
+12
@@ -339,6 +339,18 @@ test_expect_success 'checkout w/--track from non-branch HEAD fails' '
339 test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
340 '
341
342 +test_expect_failure 'detach a symbolic link HEAD' '
343 + git checkout master &&
344 + git config --bool core.prefersymlinkrefs yes &&
345 + git checkout side &&
346 + git checkout master &&
347 + it=$(git symbolic-ref HEAD) &&
348 + test "z$it" = zrefs/heads/master &&
349 + here=$(git rev-parse --verify refs/heads/master) &&
350 + git checkout side^ &&
351 + test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
352 +'
353 +
354 test_expect_success 'checkout an unmerged path should fail' '
355 rm -f .git/index &&
356 O=$(echo original | git hash-object -w --stdin) &&