Merge branch 'master' of git://git.kernel.org/pub/scm/git/git
[git/jnareb-git.git] / t / t7061-wtstatus-ignore.sh
blob0da1214bcca439c126a0e19c664ed9230a1001fe
1 #!/bin/sh
3 test_description='git-status ignored files'
5 . ./test-lib.sh
7 cat >expected <<\EOF
8 ?? .gitignore
9 ?? actual
10 ?? expected
11 ?? untracked/
12 EOF
14 test_expect_success 'status untracked directory with --ignored' '
15 echo "ignored" >.gitignore &&
16 mkdir untracked &&
17 : >untracked/ignored &&
18 : >untracked/uncommitted &&
19 git status --porcelain --ignored >actual &&
20 test_cmp expected actual
23 cat >expected <<\EOF
24 ?? .gitignore
25 ?? actual
26 ?? expected
27 ?? untracked/uncommitted
28 !! untracked/ignored
29 EOF
31 test_expect_success 'status untracked directory with --ignored -u' '
32 git status --porcelain --ignored -u >actual &&
33 test_cmp expected actual
36 cat >expected <<\EOF
37 ?? .gitignore
38 ?? actual
39 ?? expected
40 !! ignored/
41 EOF
43 test_expect_success 'status ignored directory with --ignore' '
44 rm -rf untracked &&
45 mkdir ignored &&
46 : >ignored/uncommitted &&
47 git status --porcelain --ignored >actual &&
48 test_cmp expected actual
51 cat >expected <<\EOF
52 ?? .gitignore
53 ?? actual
54 ?? expected
55 !! ignored/uncommitted
56 EOF
58 test_expect_success 'status ignored directory with --ignore -u' '
59 git status --porcelain --ignored -u >actual &&
60 test_cmp expected actual
63 cat >expected <<\EOF
64 ?? .gitignore
65 ?? actual
66 ?? expected
67 !! untracked-ignored/
68 EOF
70 test_expect_success 'status untracked directory with ignored files with --ignore' '
71 rm -rf ignored &&
72 mkdir untracked-ignored &&
73 mkdir untracked-ignored/test &&
74 : >untracked-ignored/ignored &&
75 : >untracked-ignored/test/ignored &&
76 git status --porcelain --ignored >actual &&
77 test_cmp expected actual
80 cat >expected <<\EOF
81 ?? .gitignore
82 ?? actual
83 ?? expected
84 !! untracked-ignored/ignored
85 !! untracked-ignored/test/ignored
86 EOF
88 test_expect_success 'status untracked directory with ignored files with --ignore -u' '
89 git status --porcelain --ignored -u >actual &&
90 test_cmp expected actual
93 cat >expected <<\EOF
94 ?? .gitignore
95 ?? actual
96 ?? expected
97 EOF
99 test_expect_success 'status ignored tracked directory with --ignore' '
100 rm -rf untracked-ignored &&
101 mkdir tracked &&
102 : >tracked/committed &&
103 git add tracked/committed &&
104 git commit -m. &&
105 echo "tracked" >.gitignore &&
106 git status --porcelain --ignored >actual &&
107 test_cmp expected actual
110 cat >expected <<\EOF
111 ?? .gitignore
112 ?? actual
113 ?? expected
116 test_expect_success 'status ignored tracked directory with --ignore -u' '
117 git status --porcelain --ignored -u >actual &&
118 test_cmp expected actual
121 cat >expected <<\EOF
122 ?? .gitignore
123 ?? actual
124 ?? expected
125 !! tracked/
128 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
129 : >tracked/uncommitted &&
130 git status --porcelain --ignored >actual &&
131 test_cmp expected actual
134 cat >expected <<\EOF
135 ?? .gitignore
136 ?? actual
137 ?? expected
138 !! tracked/uncommitted
141 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' '
142 git status --porcelain --ignored -u >actual &&
143 test_cmp expected actual
146 test_done