summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-11-02 13:36:14 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-11-02 13:36:14 -0800
commit581000a4196d196d221bb6164a49a8a52ce30730 (patch)
treed177274e6739292d466213fc02abf5811bf86ce6 /t
parentStart 1.6.0.4 cycle (diff)
parentEnhance hold_lock_file_for_{update,append}() API (diff)
downloadtgif-581000a4196d196d221bb6164a49a8a52ce30730.tar.xz
Merge branch 'jc/maint-co-track' into maint
* jc/maint-co-track: Enhance hold_lock_file_for_{update,append}() API demonstrate breakage of detached checkout with symbolic link HEAD Fix "checkout --track -b newbranch" on detached HEAD
Diffstat (limited to 't')
-rwxr-xr-xt/t7201-co.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 0679abd29d..c9abed6a2b 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -330,12 +330,26 @@ test_expect_success \
test "$(git config branch.track2.merge)"
git config branch.autosetupmerge false'
-test_expect_success \
- 'checkout w/--track from non-branch HEAD fails' '
- git checkout -b delete-me master &&
- rm .git/refs/heads/delete-me &&
- test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
- test_must_fail git checkout --track -b track'
+test_expect_success 'checkout w/--track from non-branch HEAD fails' '
+ git checkout master^0 &&
+ test_must_fail git symbolic-ref HEAD &&
+ test_must_fail git checkout --track -b track &&
+ test_must_fail git rev-parse --verify track &&
+ test_must_fail git symbolic-ref HEAD &&
+ test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
+'
+
+test_expect_success '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 &&