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