archive: handle commits with an empty tree
[git/jnareb-git.git] / t / t2204-add-ignored.sh
blob8340ac2f073446963f7f5dab39ac87771264da54
1 #!/bin/sh
3 test_description='giving ignored paths to git add'
5 . ./test-lib.sh
7 test_expect_success setup '
8 mkdir sub dir dir/sub &&
9 echo sub >.gitignore &&
10 echo ign >>.gitignore &&
11 for p in . sub dir dir/sub
13 >"$p/ign" &&
14 >"$p/file" || exit 1
15 done
18 for i in file dir/file dir 'd*'
20 test_expect_success "no complaints for unignored $i" '
21 rm -f .git/index &&
22 git add "$i" &&
23 git ls-files "$i" >out &&
24 test -s out
26 done
28 for i in ign dir/ign dir/sub dir/sub/*ign sub/file sub sub/*
30 test_expect_success "complaints for ignored $i" '
31 rm -f .git/index &&
32 test_must_fail git add "$i" 2>err &&
33 git ls-files "$i" >out &&
34 ! test -s out
37 test_expect_success "complaints for ignored $i output" '
38 test_i18ngrep -e "Use -f if" err
41 test_expect_success "complaints for ignored $i with unignored file" '
42 rm -f .git/index &&
43 test_must_fail git add "$i" file 2>err &&
44 git ls-files "$i" >out &&
45 ! test -s out
47 test_expect_success "complaints for ignored $i with unignored file output" '
48 test_i18ngrep -e "Use -f if" err
50 done
52 for i in sub sub/*
54 test_expect_success "complaints for ignored $i in dir" '
55 rm -f .git/index &&
57 cd dir &&
58 test_must_fail git add "$i" 2>err &&
59 git ls-files "$i" >out &&
60 ! test -s out
64 test_expect_success "complaints for ignored $i in dir output" '
66 cd dir &&
67 test_i18ngrep -e "Use -f if" err
70 done
72 for i in ign file
74 test_expect_success "complaints for ignored $i in sub" '
75 rm -f .git/index &&
77 cd sub &&
78 test_must_fail git add "$i" 2>err &&
79 git ls-files "$i" >out &&
80 ! test -s out
84 test_expect_success "complaints for ignored $i in sub output" '
86 cd sub &&
87 test_i18ngrep -e "Use -f if" err
90 done
92 test_done