3 test_description
='git archive attribute pattern tests'
5 TEST_PASSES_SANITIZE_LEAK
=true
6 TEST_CREATE_REPO_NO_TEMPLATE
=1
10 test_expect_success
" $1 exists" "test -e $1"
13 test_expect_missing
() {
14 test_expect_success
" $1 does not exist" "test ! -e $1"
17 test_expect_success
'setup' '
18 echo ignored >ignored &&
20 echo ignored export-ignore >>.git/info/attributes &&
23 mkdir not-ignored-dir &&
24 echo ignored-in-tree >not-ignored-dir/ignored &&
25 echo not-ignored-in-tree >not-ignored-dir/ignored-only-if-dir &&
26 git add not-ignored-dir &&
28 mkdir ignored-only-if-dir &&
29 echo ignored by ignored dir >ignored-only-if-dir/ignored-by-ignored-dir &&
30 echo ignored-only-if-dir/ export-ignore >>.git/info/attributes &&
31 git add ignored-only-if-dir &&
33 mkdir -p ignored-without-slash &&
34 echo "ignored without slash" >ignored-without-slash/foo &&
35 git add ignored-without-slash/foo &&
36 echo "ignored-without-slash export-ignore" >>.git/info/attributes &&
38 mkdir -p wildcard-without-slash &&
39 echo "ignored without slash" >wildcard-without-slash/foo &&
40 git add wildcard-without-slash/foo &&
41 echo "wild*-without-slash export-ignore" >>.git/info/attributes &&
43 mkdir -p deep/and/slashless &&
44 echo "ignored without slash" >deep/and/slashless/foo &&
45 git add deep/and/slashless/foo &&
46 echo "deep/and/slashless export-ignore" >>.git/info/attributes &&
48 mkdir -p deep/with/wildcard &&
49 echo "ignored without slash" >deep/with/wildcard/foo &&
50 git add deep/with/wildcard/foo &&
51 echo "deep/*t*/wildcard export-ignore" >>.git/info/attributes &&
53 mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir &&
54 echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir &&
55 git add one-level-lower &&
59 git clone --template= --bare . bare &&
61 cp .git/info/attributes bare/info/attributes
64 test_expect_success
'git archive' '
65 git archive HEAD >archive.tar &&
66 (mkdir archive && cd archive && "$TAR" xf -) <archive.tar
69 test_expect_missing archive
/ignored
70 test_expect_missing archive
/not-ignored-dir
/ignored
71 test_expect_exists archive
/not-ignored-dir
/ignored-only-if-dir
72 test_expect_exists archive
/not-ignored-dir
/
73 test_expect_missing archive
/ignored-only-if-dir
/
74 test_expect_missing archive
/ignored-ony-if-dir
/ignored-by-ignored-dir
75 test_expect_missing archive
/ignored-without-slash
/ &&
76 test_expect_missing archive
/ignored-without-slash
/foo
&&
77 test_expect_missing archive
/wildcard-without-slash
/
78 test_expect_missing archive
/wildcard-without-slash
/foo
&&
79 test_expect_missing archive
/deep
/and
/slashless
/ &&
80 test_expect_missing archive
/deep
/and
/slashless
/foo
&&
81 test_expect_missing archive
/deep
/with
/wildcard
/ &&
82 test_expect_missing archive
/deep
/with
/wildcard
/foo
&&
83 test_expect_missing archive
/one-level-lower
/
84 test_expect_missing archive
/one-level-lower
/two-levels-lower
/ignored-only-if-dir
/
85 test_expect_missing archive
/one-level-lower
/two-levels-lower
/ignored-ony-if-dir
/ignored-by-ignored-dir