summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-22 00:21:10 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-22 00:21:10 (GMT)
commitafb5b6a24bd333d298d10acac731f1c127bbb82d (patch)
tree9c403d4fa96f00d172e5b0a95602b68be839086f /t
parent99ebd06c18fdb7f8274db6cca456a95942916bb6 (diff)
parent1c3e5c4ebc326c5c70350d3f4dc7f2b29e813480 (diff)
downloadgit-afb5b6a24bd333d298d10acac731f1c127bbb82d.zip
git-afb5b6a24bd333d298d10acac731f1c127bbb82d.tar.gz
git-afb5b6a24bd333d298d10acac731f1c127bbb82d.tar.bz2
Merge branch 'lt/gitlink'
* lt/gitlink: Tests for core subproject support Expose subprojects as special files to "git diff" machinery Fix some "git ls-files -o" fallout from gitlinks Teach "git-read-tree -u" to check out submodules as a directory Teach git list-objects logic to not follow gitlinks Fix gitlink index entry filesystem matching Teach "git-read-tree -u" to check out submodules as a directory Teach git list-objects logic not to follow gitlinks Don't show gitlink directories when we want "other" files Teach git-update-index about gitlinks Teach directory traversal about subprojects Fix thinko in subproject entry sorting Teach core object handling functions about gitlinks Teach "fsck" not to follow subproject links Add "S_IFDIRLNK" file mode infrastructure for git links Add 'resolve_gitlink_ref()' helper function Avoid overflowing name buffer in deep directory structures diff-lib: use ce_mode_from_stat() rather than messing with modes manually
Diffstat (limited to 't')
-rwxr-xr-xt/t3040-subprojects-basic.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/t/t3040-subprojects-basic.sh b/t/t3040-subprojects-basic.sh
new file mode 100755
index 0000000..79b9f23
--- /dev/null
+++ b/t/t3040-subprojects-basic.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+test_description='Basic subproject functionality'
+. ./test-lib.sh
+
+test_expect_success 'Super project creation' \
+ ': >Makefile &&
+ git add Makefile &&
+ git commit -m "Superproject created"'
+
+
+cat >expected <<EOF
+:000000 160000 00000... A sub1
+:000000 160000 00000... A sub2
+EOF
+test_expect_success 'create subprojects' \
+ 'mkdir sub1 &&
+ ( cd sub1 && git init && : >Makefile && git add * &&
+ git commit -q -m "subproject 1" ) &&
+ mkdir sub2 &&
+ ( cd sub2 && git init && : >Makefile && git add * &&
+ git commit -q -m "subproject 2" ) &&
+ git update-index --add sub1 &&
+ git add sub2 &&
+ git commit -q -m "subprojects added" &&
+ git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
+ git diff expected current'
+
+git branch save HEAD
+
+test_expect_success 'check if fsck ignores the subprojects' \
+ 'git fsck --full'
+
+test_expect_success 'check if commit in a subproject detected' \
+ '( cd sub1 &&
+ echo "all:" >>Makefile &&
+ echo " true" >>Makefile &&
+ git commit -q -a -m "make all" ) && {
+ git diff-files --exit-code
+ test $? = 1
+ }'
+
+test_expect_success 'check if a changed subproject HEAD can be committed' \
+ 'git commit -q -a -m "sub1 changed" && {
+ git diff-tree --exit-code HEAD^ HEAD
+ test $? = 1
+ }'
+
+test_expect_success 'check if diff-index works for subproject elements' \
+ 'git diff-index --exit-code --cached save -- sub1
+ test $? = 1'
+
+test_expect_success 'check if diff-tree works for subproject elements' \
+ 'git diff-tree --exit-code HEAD^ HEAD -- sub1
+ test $? = 1'
+
+test_expect_success 'check if git diff works for subproject elements' \
+ 'git diff --exit-code HEAD^ HEAD
+ test $? = 1'
+
+test_expect_success 'check if clone works' \
+ 'git ls-files -s >expected &&
+ git clone -l -s . cloned &&
+ ( cd cloned && git ls-files -s ) >current &&
+ git diff expected current'
+
+test_expect_success 'removing and adding subproject' \
+ 'git update-index --force-remove -- sub2 &&
+ mv sub2 sub3 &&
+ git add sub3 &&
+ git commit -q -m "renaming a subproject" && {
+ git diff -M --name-status --exit-code HEAD^ HEAD
+ test $? = 1
+ }'
+
+# the index must contain the object name the HEAD of the
+# subproject sub1 was at the point "save"
+test_expect_success 'checkout in superproject' \
+ 'git checkout save &&
+ git diff-index --exit-code --raw --cached save -- sub1'
+
+# just interesting what happened...
+# git diff --name-status -M save master
+
+test_done