[PATCH] Add core.mode configuration
From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:46
Subsystem:
the rest · Maintainer:
Linus Torvalds
So that we can specify general modes of operation, specifically, add the 'next' mode, which makes Git pre v2.0 behave as Git v2.0. Signed-off-by: Felipe Contreras <redacted> --- builtin/add.c | 3 +++ cache.h | 6 ++++++ config.c | 13 +++++++++++++ environment.c | 1 + 4 files changed, 23 insertions(+)
diff --git a/builtin/add.c b/builtin/add.c
index 8266a9c..85b4c54 100644
--- a/builtin/add.c
+++ b/builtin/add.c@@ -41,6 +41,9 @@ static void warn_pathless_add(void) static int shown; assert(option_with_implicit_dot && short_option_with_implicit_dot); + if (git_mode == MODE_NEXT) + return; + if (shown) return; shown = 1;
diff --git a/cache.h b/cache.h
index 85b544f..f28240f 100644
--- a/cache.h
+++ b/cache.h@@ -627,9 +627,15 @@ enum push_default_type { PUSH_DEFAULT_UNSPECIFIED }; +enum git_mode { + MODE_CURRENT = 0, + MODE_NEXT +}; + extern enum branch_track git_branch_track; extern enum rebase_setup_type autorebase; extern enum push_default_type push_default; +extern enum git_mode git_mode; enum object_creation_mode { OBJECT_CREATION_USES_HARDLINKS = 0,
diff --git a/config.c b/config.c
index e13a7b6..f0e0370 100644
--- a/config.c
+++ b/config.c@@ -831,6 +831,19 @@ static int git_default_core_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.mode")) { + if (!value) + return config_error_nonbool(var); + else if (!strcmp(value, "current")) + git_mode = MODE_CURRENT; + else if (!strcmp(value, "next")) { + git_mode = MODE_NEXT; + push_default = PUSH_DEFAULT_SIMPLE; + } else + die("wrong mode '%s'", value); + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; }
diff --git a/environment.c b/environment.c
index 5398c36..751e14d 100644
--- a/environment.c
+++ b/environment.c@@ -62,6 +62,7 @@ int merge_log_config = -1; int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */ struct startup_info *startup_info; unsigned long pack_size_limit_cfg; +enum git_mode git_mode = MODE_CURRENT; /* * The character that begins a commented line in user-editable file
--
1.8.4-fc