aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-12 14:02:19 -0800
committerJunio C Hamano <gitster@pobox.com>2015-01-12 14:02:19 -0800
commitd0879b33a6c34285a870e351e8eaee5cd695e92d (patch)
tree17df01c0a750aabdc9ec86e40921a2c37597b48b
parentefc028b1f2c6da6558094326083f7643453bfccd (diff)
parent1d31e5a2cd9f90799330d5095783e7b972357f0e (diff)
downloadgit-d0879b33a6c34285a870e351e8eaee5cd695e92d.tar.gz
git-d0879b33a6c34285a870e351e8eaee5cd695e92d.tar.xz
Merge branch 'mg/add-ignore-errors' into maint
* mg/add-ignore-errors: add: ignore only ignored files
-rw-r--r--builtin/add.c2
-rwxr-xr-xt/t3700-add.sh8
2 files changed, 8 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ae6d3e262..1074e3234 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -284,7 +284,7 @@ static int add_files(struct dir_struct *dir, int flags)
for (i = 0; i < dir->ignored_nr; i++)
fprintf(stderr, "%s\n", dir->ignored[i]->name);
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++)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index fe274e2fb..f7ff1f555 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -91,6 +91,13 @@ test_expect_success 'error out when attempting to add ignored ones without -f' '
! (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' '
git add -f a.?? &&
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:
ignored-file
Use -f if you really want to add them.
-fatal: no files added
EOF
cat >expect.out <<\EOF
add 'track-this'