git-bisect.txt: example for bisecting with hot-fix
[git/jnareb-git.git] / t / t2204-add-ignored.sh
blob24afdabab7e30feaf583079a75a756d267181bb9
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 &&
35 grep -e "Use -f if" err &&
36 cat err
39 test_expect_success "complaints for ignored $i with unignored file" '
40 rm -f .git/index &&
41 test_must_fail git add "$i" file 2>err &&
42 git ls-files "$i" >out &&
43 ! test -s out &&
44 grep -e "Use -f if" err &&
45 cat err
47 done
49 for i in sub sub/*
51 test_expect_success "complaints for ignored $i in dir" '
52 rm -f .git/index &&
54 cd dir &&
55 test_must_fail git add "$i" 2>err &&
56 git ls-files "$i" >out &&
57 ! test -s out &&
58 grep -e "Use -f if" err &&
59 cat err
62 done
64 for i in ign file
66 test_expect_success "complaints for ignored $i in sub" '
67 rm -f .git/index &&
69 cd sub &&
70 test_must_fail git add "$i" 2>err &&
71 git ls-files "$i" >out &&
72 ! test -s out &&
73 grep -e "Use -f if" err &&
74 cat err
77 done
79 test_done