Merge branch 'mg/add-ignore-errors' into maint
* mg/add-ignore-errors: add: ignore only ignored files
This commit is contained in:
commit
d0879b33a6
@ -284,7 +284,7 @@ static int add_files(struct dir_struct *dir, int flags)
|
|||||||
for (i = 0; i < dir->ignored_nr; i++)
|
for (i = 0; i < dir->ignored_nr; i++)
|
||||||
fprintf(stderr, "%s\n", dir->ignored[i]->name);
|
fprintf(stderr, "%s\n", dir->ignored[i]->name);
|
||||||
fprintf(stderr, _("Use -f if you really want to add them.\n"));
|
fprintf(stderr, _("Use -f if you really want to add them.\n"));
|
||||||
die(_("no files added"));
|
exit_status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < dir->nr; i++)
|
for (i = 0; i < dir->nr; i++)
|
||||||
|
@ -91,6 +91,13 @@ test_expect_success 'error out when attempting to add ignored ones without -f' '
|
|||||||
! (git ls-files | grep "\\.ig")
|
! (git ls-files | grep "\\.ig")
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'error out when attempting to add ignored ones but add others' '
|
||||||
|
touch a.if &&
|
||||||
|
test_must_fail git add a.?? &&
|
||||||
|
! (git ls-files | grep "\\.ig") &&
|
||||||
|
(git ls-files | grep a.if)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'add ignored ones with -f' '
|
test_expect_success 'add ignored ones with -f' '
|
||||||
git add -f a.?? &&
|
git add -f a.?? &&
|
||||||
git ls-files --error-unmatch a.ig
|
git ls-files --error-unmatch a.ig
|
||||||
@ -311,7 +318,6 @@ cat >expect.err <<\EOF
|
|||||||
The following paths are ignored by one of your .gitignore files:
|
The following paths are ignored by one of your .gitignore files:
|
||||||
ignored-file
|
ignored-file
|
||||||
Use -f if you really want to add them.
|
Use -f if you really want to add them.
|
||||||
fatal: no files added
|
|
||||||
EOF
|
EOF
|
||||||
cat >expect.out <<\EOF
|
cat >expect.out <<\EOF
|
||||||
add 'track-this'
|
add 'track-this'
|
||||||
|
Loading…
Reference in New Issue
Block a user