Documentation/config.txt says it all. Signed-off-by: Clemens Buchacher <drizzd@xxxxxx> --- Documentation/config.txt | 6 ++++++ builtin-add.c | 2 +- builtin-grep.c | 2 +- cache.h | 1 + config.c | 8 ++++++++ environment.c | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 5256c7f..f587cf1 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -439,6 +439,12 @@ On some file system/operating system combinations, this is unreliable. Set this config setting to 'rename' there; However, This will remove the check that makes sure that existing object files will not get overwritten. +core.scope:: + By default, the commands 'git add -u', 'git add -A' and 'git grep' + are limited to files below the current working directory + (scope='workdir'). Set this variable to scope='global' to make these + commands act on the whole tree instead. + add.ignore-errors:: Tells 'git-add' to continue adding files when some files cannot be added due to indexing errors. Equivalent to the '--ignore-errors' diff --git a/builtin-add.c b/builtin-add.c index 006fd08..33ea3e4 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -285,7 +285,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (addremove && take_worktree_changes) die("-A and -u are mutually incompatible"); - if ((addremove || take_worktree_changes) && !argc) { + if (!scope_global && (addremove || take_worktree_changes) && !argc) { static const char *here[2] = { ".", NULL }; argc = 1; argv = here; diff --git a/builtin-grep.c b/builtin-grep.c index f6af3d4..447b195 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -861,7 +861,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) if (i < argc) paths = get_pathspec(prefix, argv + i); - else if (prefix) { + else if (!scope_global && prefix) { paths = xcalloc(2, sizeof(const char *)); paths[0] = prefix; paths[1] = NULL; diff --git a/cache.h b/cache.h index 5fad24c..85c5fee 100644 --- a/cache.h +++ b/cache.h @@ -523,6 +523,7 @@ extern int auto_crlf; extern int read_replace_refs; extern int fsync_object_files; extern int core_preload_index; +extern int scope_global; enum safe_crlf { SAFE_CRLF_FALSE = 0, diff --git a/config.c b/config.c index e87edea..8dec019 100644 --- a/config.c +++ b/config.c @@ -503,6 +503,14 @@ static int git_default_core_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.scope")) { + if (!strcasecmp(value, "global")) + scope_global = 1; + if (!strcasecmp(value, "worktree")) + scope_global = 0; + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; } diff --git a/environment.c b/environment.c index 5de6837..4d1c6e1 100644 --- a/environment.c +++ b/environment.c @@ -50,6 +50,7 @@ enum push_default_type push_default = PUSH_DEFAULT_MATCHING; #endif enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE; int grafts_replace_parents = 1; +int scope_global = 0; /* Parallel index stat data preload? */ int core_preload_index = 0; -- 1.6.4.2.264.g79b4f -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html