File tree Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ test_description=' giving ignored paths to git add'
4
+
5
+ . ./test-lib.sh
6
+
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
12
+ do
13
+ >"$p/ign" &&
14
+ >"$p/file" || exit 1
15
+ done
16
+ '
17
+
18
+ for i in file dir/file dir ' d*'
19
+ do
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
25
+ '
26
+ done
27
+
28
+ for i in ign dir/ign dir/sub dir/sub/* ign sub/file sub sub/*
29
+ do
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
37
+ '
38
+
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
46
+ '
47
+ done
48
+
49
+ for i in sub sub/*
50
+ do
51
+ test_expect_success " complaints for ignored $i in dir" '
52
+ rm -f .git/index &&
53
+ (
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
60
+ )
61
+ '
62
+ done
63
+
64
+ for i in ign file
65
+ do
66
+ test_expect_success " complaints for ignored $i in sub" '
67
+ rm -f .git/index &&
68
+ (
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
75
+ )
76
+ '
77
+ done
78
+
79
+ test_done
You can’t perform that action at this time.
0 commit comments