[PATCH 1/2] config: refactor management of color.ui's default value

2013-06-10 Thread Matthieu Moy
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@imag.fr
Signed-off-by: Junio C Hamano gits...@pobox.com
---
This one is just a resend of what's already in pu.

 builtin/config.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/builtin/config.c b/builtin/config.c
index 33c9bf9..057bb61 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) {
-- 
1.8.3.rc3.8.g5e49f30

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] config: refactor management of color.ui's default value

2013-05-15 Thread Matthieu Moy
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@imag.fr
---
So, this is new, as suggested by Junio.

 builtin/config.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/builtin/config.c b/builtin/config.c
index 000d27c..171bad7 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -333,6 +333,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, given_config_blob,
respect_includes);
@@ -344,6 +345,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) {
-- 
1.8.3.rc1.315.g4602f33

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html