3 test_description
='Basic subproject functionality'
6 test_expect_success
'Super project creation' \
9 git commit -m "Superproject created"'
13 :000000 160000 00000... A sub1
14 :000000 160000 00000... A sub2
16 test_expect_success
'create subprojects' \
18 ( cd sub1 && git init && : >Makefile && git add * &&
19 git commit -q -m "subproject 1" ) &&
21 ( cd sub2 && git init && : >Makefile && git add * &&
22 git commit -q -m "subproject 2" ) &&
23 git update-index --add sub1 &&
25 git commit -q -m "subprojects added" &&
26 git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
27 test_cmp expected current'
31 test_expect_success
'check if fsck ignores the subprojects' \
34 test_expect_success
'check if commit in a subproject detected' \
36 echo "all:" >>Makefile &&
37 echo " true" >>Makefile &&
38 git commit -q -a -m "make all" ) && {
39 git diff-files --exit-code
43 test_expect_success
'check if a changed subproject HEAD can be committed' \
44 'git commit -q -a -m "sub1 changed" && {
45 git diff-tree --exit-code HEAD^ HEAD
49 test_expect_success
'check if diff-index works for subproject elements' \
50 'git diff-index --exit-code --cached save -- sub1
53 test_expect_success
'check if diff-tree works for subproject elements' \
54 'git diff-tree --exit-code HEAD^ HEAD -- sub1
57 test_expect_success
'check if git diff works for subproject elements' \
58 'git diff --exit-code HEAD^ HEAD
61 test_expect_success
'check if clone works' \
62 'git ls-files -s >expected &&
63 git clone -l -s . cloned &&
64 ( cd cloned && git ls-files -s ) >current &&
65 test_cmp expected current'
67 test_expect_success
'removing and adding subproject' \
68 'git update-index --force-remove -- sub2 &&
71 git commit -q -m "renaming a subproject" && {
72 git diff -M --name-status --exit-code HEAD^ HEAD
76 # the index must contain the object name the HEAD of the
77 # subproject sub1 was at the point "save"
78 test_expect_success
'checkout in superproject' \
80 git diff-index --exit-code --raw --cached save -- sub1'
82 # just interesting what happened...
83 # git diff --name-status -M save master