summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2014-11-21 16:08:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-11-21 18:19:14 (GMT)
commit1d31e5a2cd9f90799330d5095783e7b972357f0e (patch)
tree4c4818b087c976b037874f9c8db057307aede563 /builtin/add.c
parent7ba2ba7d12163a8f9a9947d7880bd26f2970d4c5 (diff)
downloadgit-1d31e5a2cd9f90799330d5095783e7b972357f0e.zip
git-1d31e5a2cd9f90799330d5095783e7b972357f0e.tar.gz
git-1d31e5a2cd9f90799330d5095783e7b972357f0e.tar.bz2
add: ignore only ignored files
"git add foo bar" adds neither foo nor bar when bar is ignored, but dies to let the user recheck their command invocation. This becomes less helpful when "git add foo.*" is subject to shell expansion and some of the expanded files are ignored. "git add --ignore-errors" is supposed to ignore errors when indexing some files and adds the others. It does ignore errors from actual indexing attempts, but does not ignore the error "file is ignored" as outlined above. This is unexpected. Change "git add foo bar" to add foo when bar is ignored, but issue a warning and return a failure code as before the change. That is, in the case of trying to add ignored files we now act the same way (with or without "--ignore-errors") in which we act for more severe indexing errors when "--ignore-errors" is specified. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ae6d3e2..1074e32 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++)