diff options
author | Heiko Voigt <hvoigt@hvoigt.net> | 2013-12-04 23:21:05 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-06 12:56:11 -0800 |
commit | 66d237b834f13fdf9ba46da6cc3a3658ff34bd18 (patch) | |
tree | c68fbd3ab4b503634853714e117c693b5b0e948c | |
parent | a155a5f075cdc09e584a58d68bdce0c80e6c4b5a (diff) | |
download | git-66d237b834f13fdf9ba46da6cc3a3658ff34bd18.tar.gz |
fix 'git add' to skip submodules configured as ignored
If submodules are configured as ignore=all they are not shown by status.
Lets also ignore them when adding files to the index. This avoids that
users accidentially add ignored submodules with: git add .
We achieve this by reading the submodule config and thus correctly
initializing the infrastructure to take the ignore decision.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/add.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c index 226f758869..2d0d2efcbd 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -15,6 +15,7 @@ #include "diffcore.h" #include "revision.h" #include "bulk-checkin.h" +#include "submodule.h" static const char * const builtin_add_usage[] = { N_("git add [options] [--] <pathspec>..."), @@ -378,6 +379,10 @@ static int add_config(const char *var, const char *value, void *cb) ignore_add_errors = git_config_bool(var, value); return 0; } + + if (!prefixcmp(var, "submodule.")) + return parse_submodule_config_option(var, value); + return git_default_config(var, value, cb); } @@ -415,6 +420,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) int implicit_dot = 0; struct update_callback_data update_data; + gitmodules_config(); git_config(add_config, NULL); argc = parse_options(argc, argv, prefix, builtin_add_options, |