Add a test for git-add --ignore-errors
Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
May 12, 2008 at 19:58 UTC
89597436450d4665ea8f9f782e71d42539d9f24b
1 file changed
+22
t/t3700-add.sh
+22
@@ -179,4 +179,26 @@ test_expect_success 'git add --refresh' '
179
test -z "`git diff-index HEAD -- foo`"
180
'
181
182
+test_expect_success 'git add should fail atomically upon an unreadable file' '
183
+ git reset --hard &&
184
+ date >foo1 &&
185
+ date >foo2 &&
186
+ chmod 0 foo2 &&
187
+ test_must_fail git add --verbose . &&
188
+ ! ( git ls-files foo1 | grep foo1 )
189
+'
190
+
191
+rm -f foo2
192
+
193
+test_expect_success 'git add --ignore-errors' '
194
+ git reset --hard &&
195
+ date >foo1 &&
196
+ date >foo2 &&
197
+ chmod 0 foo2 &&
198
+ test_must_fail git add --verbose --ignore-errors . &&
199
+ git ls-files foo1 | grep foo1
200
+'
201
+
202
+rm -f foo2
203
+
204
test_done