File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ static int add_files(struct dir_struct *dir, int flags)
284
284
for (i = 0 ; i < dir -> ignored_nr ; i ++ )
285
285
fprintf (stderr , "%s\n" , dir -> ignored [i ]-> name );
286
286
fprintf (stderr , _ ("Use -f if you really want to add them.\n" ));
287
- die ( _ ( "no files added" )) ;
287
+ exit_status = 1 ;
288
288
}
289
289
290
290
for (i = 0 ; i < dir -> nr ; i ++ )
Original file line number Diff line number Diff line change @@ -91,6 +91,13 @@ test_expect_success 'error out when attempting to add ignored ones without -f' '
91
91
! (git ls-files | grep "\\.ig")
92
92
'
93
93
94
+ test_expect_success ' error out when attempting to add ignored ones but add others' '
95
+ touch a.if &&
96
+ test_must_fail git add a.?? &&
97
+ ! (git ls-files | grep "\\.ig") &&
98
+ (git ls-files | grep a.if)
99
+ '
100
+
94
101
test_expect_success ' add ignored ones with -f' '
95
102
git add -f a.?? &&
96
103
git ls-files --error-unmatch a.ig
@@ -311,7 +318,6 @@ cat >expect.err <<\EOF
311
318
The following paths are ignored by one of your .gitignore files:
312
319
ignored-file
313
320
Use -f if you really want to add them.
314
- fatal: no files added
315
321
EOF
316
322
cat > expect.out << \EOF
317
323
add 'track-this'
You can’t perform that action at this time.
0 commit comments