checkout,clone: check return value of create_symref
[alt-git.git] / t / t2011-checkout-invalid-head.sh
blobd444d5ee417220e8428543a6c76d5839ce91b979
1 #!/bin/sh
3 test_description='checkout switching away from an invalid branch'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 echo hello >world &&
9 git add world &&
10 git commit -m initial
13 test_expect_success 'checkout should not start branch from a tree' '
14 test_must_fail git checkout -b newbranch master^{tree}
17 test_expect_success 'checkout master from invalid HEAD' '
18 echo $_z40 >.git/HEAD &&
19 git checkout master --
22 test_expect_success 'checkout notices failure to lock HEAD' '
23 test_when_finished "rm -f .git/HEAD.lock" &&
24 >.git/HEAD.lock &&
25 test_must_fail git checkout -b other
28 test_done