From 4df1b8e8b87c502bd7fea614de1d9cf589c90850 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 17 Sep 2013 08:50:10 -0500 Subject: [PATCH] Add core.mode configuration So that we can specify general modes of operation, specifically, add the 'next' mode, which makes Git behave as the next backwards-incompatible version. Signed-off-by: Felipe Contreras --- cache.h | 6 ++++++ config.c | 12 ++++++++++++ environment.c | 1 + 3 files changed, 19 insertions(+) diff --git a/cache.h b/cache.h index b829410f6d..68fd9fcdca 100644 --- a/cache.h +++ b/cache.h @@ -723,9 +723,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 9ba40bc1b0..3da2a59bbc 100644 --- a/config.c +++ b/config.c @@ -912,6 +912,18 @@ 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; + } 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 6dec9d0403..5832bbc8fb 100644 --- a/environment.c +++ b/environment.c @@ -76,6 +76,7 @@ int protect_hfs = PROTECT_HFS_DEFAULT; #define PROTECT_NTFS_DEFAULT 0 #endif int protect_ntfs = PROTECT_NTFS_DEFAULT; +enum git_mode git_mode = MODE_CURRENT; /* * The character that begins a commented line in user-editable file -- 2.32.0.93.g670b81a890