]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t5610-clone-detached.sh
3 test_description
='test cloning a repository with detached HEAD'
7 git
--git-dir=$1/.git rev-parse
--verify HEAD
&&
8 test_must_fail git
--git-dir=$1/.git symbolic-ref HEAD
11 test_expect_success
'setup' '
16 git commit -a -m two &&
19 git commit -a -m three
22 test_expect_success
'clone repo (detached HEAD points to branch)' '
23 git checkout master^0 &&
24 git clone "file://$PWD" detached-branch
26 test_expect_success
'cloned HEAD matches' '
28 git --git-dir=detached-branch/.git log -1 --format=%s >actual &&
29 test_cmp expect actual
31 test_expect_failure
'cloned HEAD is detached' '
32 head_is_detached detached-branch
35 test_expect_success
'clone repo (detached HEAD points to tag)' '
37 git clone "file://$PWD" detached-tag
39 test_expect_success
'cloned HEAD matches' '
41 git --git-dir=detached-tag/.git log -1 --format=%s >actual &&
42 test_cmp expect actual
44 test_expect_success
'cloned HEAD is detached' '
45 head_is_detached detached-tag
48 test_expect_success
'clone repo (detached HEAD points to history)' '
50 git clone "file://$PWD" detached-history
52 test_expect_success
'cloned HEAD matches' '
54 git --git-dir=detached-history/.git log -1 --format=%s >actual &&
55 test_cmp expect actual
57 test_expect_success
'cloned HEAD is detached' '
58 head_is_detached detached-history
61 test_expect_success
'clone repo (orphan detached HEAD)' '
62 git checkout master^0 &&
64 git commit -a -m four &&
65 git clone "file://$PWD" detached-orphan
67 test_expect_success
'cloned HEAD matches' '
69 git --git-dir=detached-orphan/.git log -1 --format=%s >actual &&
70 test_cmp expect actual
72 test_expect_success
'cloned HEAD is detached' '
73 head_is_detached detached-orphan