add DUP_ARRAY
[git.git] / t / t2204-add-ignored.sh
blob89424abccd1c5663b8c2a8a6c3b023831887f330
1 #!/bin/sh
3 test_description='giving ignored paths to git add'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 mkdir sub dir dir/sub &&
10 echo sub >.gitignore &&
11 echo ign >>.gitignore &&
12 for p in . sub dir dir/sub
14 >"$p/ign" &&
15 >"$p/file" || exit 1
16 done
19 for i in file dir/file dir 'd*'
21 test_expect_success "no complaints for unignored $i" '
22 rm -f .git/index &&
23 git add "$i" &&
24 git ls-files "$i" >out &&
25 test -s out
27 done
29 for i in ign dir/ign dir/sub dir/sub/*ign sub/file sub sub/*
31 test_expect_success "complaints for ignored $i" '
32 rm -f .git/index &&
33 test_must_fail git add "$i" 2>err &&
34 git ls-files "$i" >out &&
35 test_must_be_empty out
38 test_expect_success "complaints for ignored $i output" '
39 test_i18ngrep -e "Use -f if" err
42 test_expect_success "complaints for ignored $i with unignored file" '
43 rm -f .git/index &&
44 test_must_fail git add "$i" file 2>err &&
45 git ls-files "$i" >out &&
46 test_must_be_empty out
48 test_expect_success "complaints for ignored $i with unignored file output" '
49 test_i18ngrep -e "Use -f if" err
51 done
53 for i in sub sub/*
55 test_expect_success "complaints for ignored $i in dir" '
56 rm -f .git/index &&
58 cd dir &&
59 test_must_fail git add "$i" 2>err &&
60 git ls-files "$i" >out &&
61 test_must_be_empty out
65 test_expect_success "complaints for ignored $i in dir output" '
67 cd dir &&
68 test_i18ngrep -e "Use -f if" err
71 done
73 for i in ign file
75 test_expect_success "complaints for ignored $i in sub" '
76 rm -f .git/index &&
78 cd sub &&
79 test_must_fail git add "$i" 2>err &&
80 git ls-files "$i" >out &&
81 test_must_be_empty out
85 test_expect_success "complaints for ignored $i in sub output" '
87 cd sub &&
88 test_i18ngrep -e "Use -f if" err
91 done
93 test_done