| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git archive attribute pattern tests' |
| 4 | |
| 5 | TEST_CREATE_REPO_NO_TEMPLATE=1 |
| 6 | . ./test-lib.sh |
| 7 | |
| 8 | test_expect_exists() { |
| 9 | test_expect_success " $1 exists" "test -e $1" |
| 10 | } |
| 11 | |
| 12 | test_expect_missing() { |
| 13 | test_expect_success " $1 does not exist" "test ! -e $1" |
| 14 | } |
| 15 | |
| 16 | test_expect_success 'setup' ' |
| 17 | echo ignored >ignored && |
| 18 | mkdir .git/info && |
| 19 | echo ignored export-ignore >>.git/info/attributes && |
| 20 | git add ignored && |
| 21 | |
| 22 | mkdir not-ignored-dir && |
| 23 | echo ignored-in-tree >not-ignored-dir/ignored && |
| 24 | echo not-ignored-in-tree >not-ignored-dir/ignored-only-if-dir && |
| 25 | git add not-ignored-dir && |
| 26 | |
| 27 | mkdir ignored-only-if-dir && |
| 28 | echo ignored by ignored dir >ignored-only-if-dir/ignored-by-ignored-dir && |
| 29 | echo ignored-only-if-dir/ export-ignore >>.git/info/attributes && |
| 30 | git add ignored-only-if-dir && |
| 31 | |
| 32 | mkdir -p ignored-without-slash && |
| 33 | echo "ignored without slash" >ignored-without-slash/foo && |
| 34 | git add ignored-without-slash/foo && |
| 35 | echo "ignored-without-slash export-ignore" >>.git/info/attributes && |
| 36 | |
| 37 | mkdir -p wildcard-without-slash && |
| 38 | echo "ignored without slash" >wildcard-without-slash/foo && |
| 39 | git add wildcard-without-slash/foo && |
| 40 | echo "wild*-without-slash export-ignore" >>.git/info/attributes && |
| 41 | |
| 42 | mkdir -p deep/and/slashless && |
| 43 | echo "ignored without slash" >deep/and/slashless/foo && |
| 44 | git add deep/and/slashless/foo && |
| 45 | echo "deep/and/slashless export-ignore" >>.git/info/attributes && |
| 46 | |
| 47 | mkdir -p deep/with/wildcard && |
| 48 | echo "ignored without slash" >deep/with/wildcard/foo && |
| 49 | git add deep/with/wildcard/foo && |
| 50 | echo "deep/*t*/wildcard export-ignore" >>.git/info/attributes && |
| 51 | |
| 52 | mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir && |
| 53 | echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir && |
| 54 | git add one-level-lower && |
| 55 | |
| 56 | git commit -m. && |
| 57 | |
| 58 | git clone --template= --bare . bare && |
| 59 | mkdir bare/info && |
| 60 | cp .git/info/attributes bare/info/attributes |
| 61 | ' |
| 62 | |
| 63 | test_expect_success 'git archive' ' |
| 64 | git archive HEAD >archive.tar && |
| 65 | (mkdir archive && cd archive && "$TAR" xf -) <archive.tar |
| 66 | ' |
| 67 | |
| 68 | test_expect_missing archive/ignored |
| 69 | test_expect_missing archive/not-ignored-dir/ignored |
| 70 | test_expect_exists archive/not-ignored-dir/ignored-only-if-dir |
| 71 | test_expect_exists archive/not-ignored-dir/ |
| 72 | test_expect_missing archive/ignored-only-if-dir/ |
| 73 | test_expect_missing archive/ignored-ony-if-dir/ignored-by-ignored-dir |
| 74 | test_expect_missing archive/ignored-without-slash/ && |
| 75 | test_expect_missing archive/ignored-without-slash/foo && |
| 76 | test_expect_missing archive/wildcard-without-slash/ |
| 77 | test_expect_missing archive/wildcard-without-slash/foo && |
| 78 | test_expect_missing archive/deep/and/slashless/ && |
| 79 | test_expect_missing archive/deep/and/slashless/foo && |
| 80 | test_expect_missing archive/deep/with/wildcard/ && |
| 81 | test_expect_missing archive/deep/with/wildcard/foo && |
| 82 | test_expect_missing archive/one-level-lower/ |
| 83 | test_expect_missing archive/one-level-lower/two-levels-lower/ignored-only-if-dir/ |
| 84 | test_expect_missing archive/one-level-lower/two-levels-lower/ignored-ony-if-dir/ignored-by-ignored-dir |
| 85 | |
| 86 | |
| 87 | test_done |