Merge branch 'jk/peel-ref' into maint
[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
31         mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir &&
32         echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir &&
33         git add one-level-lower &&
34
35         git commit -m. &&
36
37         git clone --bare . bare &&
38         cp .git/info/attributes bare/info/attributes
39 '
40
41 test_expect_success 'git archive' '
42         git archive HEAD >archive.tar &&
43         (mkdir archive && cd archive && "$TAR" xf -) <archive.tar
44 '
45
46 test_expect_missing     archive/ignored
47 test_expect_missing     archive/not-ignored-dir/ignored
48 test_expect_exists      archive/not-ignored-dir/ignored-only-if-dir
49 test_expect_exists      archive/not-ignored-dir/
50 test_expect_missing     archive/ignored-only-if-dir/
51 test_expect_missing     archive/ignored-ony-if-dir/ignored-by-ignored-dir
52 test_expect_exists      archive/one-level-lower/
53 test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-only-if-dir/
54 test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-ony-if-dir/ignored-by-ignored-dir
55
56
57 test_done