1#!/bin/sh
23
test_description='git archive attribute pattern tests'
45
. ./test-lib.sh
67
test_expect_exists() {
8test_expect_success " $1 exists" "test -e $1"
9}
1011
test_expect_missing() {
12test_expect_success " $1 does not exist" "test ! -e $1"
13}
1415
test_expect_success 'setup' '
16echo ignored >ignored &&
17echo ignored export-ignore >>.git/info/attributes &&
18git add ignored &&
1920
mkdir not-ignored-dir &&
21echo ignored-in-tree >not-ignored-dir/ignored &&
22echo not-ignored-in-tree >not-ignored-dir/ignored-only-if-dir &&
23git add not-ignored-dir &&
2425
mkdir ignored-only-if-dir &&
26echo ignored by ignored dir >ignored-only-if-dir/ignored-by-ignored-dir &&
27echo ignored-only-if-dir/ export-ignore >>.git/info/attributes &&
28git add ignored-only-if-dir &&
2930
31
mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir &&
32echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir &&
33git add one-level-lower &&
3435
git commit -m. &&
3637
git clone --bare . bare &&
38cp .git/info/attributes bare/info/attributes
39'
4041
test_expect_success 'git archive' '
42git archive HEAD >archive.tar &&
43(mkdir archive && cd archive && "$TAR" xf -) <archive.tar
44'
4546
test_expect_missing archive/ignored
47test_expect_missing archive/not-ignored-dir/ignored
48test_expect_exists archive/not-ignored-dir/ignored-only-if-dir
49test_expect_exists archive/not-ignored-dir/
50test_expect_missing archive/ignored-only-if-dir/
51test_expect_missing archive/ignored-ony-if-dir/ignored-by-ignored-dir
52test_expect_exists archive/one-level-lower/
53test_expect_missing archive/one-level-lower/two-levels-lower/ignored-only-if-dir/
54test_expect_missing archive/one-level-lower/two-levels-lower/ignored-ony-if-dir/ignored-by-ignored-dir
5556
57
test_done