diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-10-17 15:56:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-10-19 12:35:04 -0700 |
commit | f5637549a7eb93883839de01399418e10bf81768 (patch) | |
tree | 76e07fe941f518e5c7e790b95d2d2214d6ad5029 /t | |
parent | 51a94af845cb3f797abd638478834721d7295af7 (diff) | |
download | git-f5637549a7eb93883839de01399418e10bf81768.tar.gz git-f5637549a7eb93883839de01399418e10bf81768.tar.xz |
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>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7201-co.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh index ee2cab6bb..3f70adaf5 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -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) && |