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)
284284 for (i = 0 ; i < dir -> ignored_nr ; i ++ )
285285 fprintf (stderr , "%s\n" , dir -> ignored [i ]-> name );
286286 fprintf (stderr , _ ("Use -f if you really want to add them.\n" ));
287- die ( _ ( "no files added" )) ;
287+ exit_status = 1 ;
288288 }
289289
290290 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' '
9191 ! (git ls-files | grep "\\.ig")
9292'
9393
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+
94101test_expect_success ' add ignored ones with -f' '
95102 git add -f a.?? &&
96103 git ls-files --error-unmatch a.ig
@@ -311,7 +318,6 @@ cat >expect.err <<\EOF
311318The following paths are ignored by one of your .gitignore files:
312319ignored-file
313320Use -f if you really want to add them.
314- fatal: no files added
315321EOF
316322cat > expect.out << \EOF
317323add 'track-this'
You can’t perform that action at this time.
0 commit comments