Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2013-05-15 21:00:55 +0400
committerJunio C Hamano <gitster@pobox.com>2013-05-15 22:02:19 +0400
commitb8612b4da45087d256a0ce339bc65611fb6586f5 (patch)
tree2eff51957666202546cbfa6efe95ad09fe2b47b9 /builtin/config.c
parent92758dd2a2de94c90c0697ef0e8174c3543a47f9 (diff)
config: refactor management of color.ui's default value
The meaning of get_colorbool_found and get_diff_color_found is "the config value if found, and -1 otherwise", but get_color_ui_found had a slightly different meaning, as it has the value 0 (which corresponds to the default value from the user point of view) when color.ui is unset. Make get_color_ui_found default to -1, and make it explicit that 0 is the default value when nothing else is found. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/config.c b/builtin/config.c
index 33c9bf9d84..057bb6127d 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -329,6 +329,7 @@ static int get_colorbool(int print)
{
get_colorbool_found = -1;
get_diff_color_found = -1;
+ get_color_ui_found = -1;
git_config_with_options(git_get_colorbool_config, NULL,
given_config_file, respect_includes);
@@ -339,6 +340,10 @@ static int get_colorbool(int print)
get_colorbool_found = get_color_ui_found;
}
+ if (get_colorbool_found < 0)
+ /* default value if none found in config */
+ get_colorbool_found = 0;
+
get_colorbool_found = want_color(get_colorbool_found);
if (print) {