Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t3040-subprojects-basic.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t3040-subprojects-basic.sh` 83 lines ยท 2371 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='Basic subproject functionality' 4 5 . ./test-lib.sh 6 7 test_expect_success 'setup: create superproject' ' 8 : >Makefile && 9 git add Makefile && 10 git commit -m "Superproject created" 11 ' 12 13 test_expect_success 'setup: create subprojects' ' 14 mkdir sub1 && 15 ( cd sub1 && git init && : >Makefile && git add * && 16 git commit -q -m "subproject 1" ) && 17 mkdir sub2 && 18 ( cd sub2 && git init && : >Makefile && git add * && 19 git commit -q -m "subproject 2" ) && 20 git update-index --add sub1 && 21 git add sub2 && 22 git commit -q -m "subprojects added" && 23 GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current && 24 git branch save HEAD && 25 cat >expected <<-\EOF && 26 :000000 160000 00000... A sub1 27 :000000 160000 00000... A sub2 28 EOF 29 test_cmp expected current 30 ' 31 32 test_expect_success 'check if fsck ignores the subprojects' ' 33 git fsck --full 34 ' 35 36 test_expect_success 'check if commit in a subproject detected' ' 37 ( cd sub1 && 38 echo "all:" >>Makefile && 39 echo " true" >>Makefile && 40 git commit -q -a -m "make all" ) && 41 test_expect_code 1 git diff-files --exit-code 42 ' 43 44 test_expect_success 'check if a changed subproject HEAD can be committed' ' 45 git commit -q -a -m "sub1 changed" && 46 test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD 47 ' 48 49 test_expect_success 'check if diff-index works for subproject elements' ' 50 test_expect_code 1 git diff-index --exit-code --cached save -- sub1 51 ' 52 53 test_expect_success 'check if diff-tree works for subproject elements' ' 54 test_expect_code 1 git diff-tree --exit-code HEAD^ HEAD -- sub1 55 ' 56 57 test_expect_success 'check if git diff works for subproject elements' ' 58 test_expect_code 1 git diff --exit-code HEAD^ HEAD 59 ' 60 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 66 ' 67 68 test_expect_success 'removing and adding subproject' ' 69 git update-index --force-remove -- sub2 && 70 mv sub2 sub3 && 71 git add sub3 && 72 git commit -q -m "renaming a subproject" && 73 test_expect_code 1 git diff -M --name-status --exit-code HEAD^ HEAD 74 ' 75 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' ' 79 git checkout save && 80 git diff-index --exit-code --raw --cached save -- sub1 81 ' 82 83 test_done