archive: handle commits with an empty tree
[git/jnareb-git.git] / t / t5002-archive-attr-pattern.sh
blob0c847fb45482b67266dc6eb9ec62b8cc7b5a9d76
1 #!/bin/sh
3 test_description='git archive attribute pattern tests'
5 . ./test-lib.sh
7 test_expect_exists() {
8 test_expect_success " $1 exists" "test -e $1"
11 test_expect_missing() {
12 test_expect_success " $1 does not exist" "test ! -e $1"
15 test_expect_success 'setup' '
16 echo ignored >ignored &&
17 echo ignored export-ignore >>.git/info/attributes &&
18 git add ignored &&
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 &&
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 &&
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 &&
35 git commit -m. &&
37 git clone --bare . bare &&
38 cp .git/info/attributes bare/info/attributes
41 test_expect_success 'git archive' '
42 git archive HEAD >archive.tar &&
43 (mkdir archive && cd archive && "$TAR" xf -) <archive.tar
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
57 test_done