{"thread":{"id":"13038","subject":"[PATCH] Use color.ui variable in scripts too","startedAt":"2008-04-09T19:32:06Z","lastAt":"2008-04-09T19:32:06Z","messageCount":1,"participants":["Matthias Kestenholz"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"73972","messageId":"1207769526-14823-1-git-send-email-mk@spinlock.ch","threadId":"13038","inReplyTo":null,"subject":"[PATCH] Use color.ui variable in scripts too","fromName":"Matthias Kestenholz","fromEmail":"mk@spinlock.ch","sentAt":"2008-04-09T19:32:06Z","receivedAt":"2008-04-09T19:32:06Z","isPatch":true,"sender":{"key":"matthias@spinlock.ch","avatar":"https://gravatar.com/avatar/bc18f396e70163d09ab458a341b1decb7e8b6ee3aa2c0c954ec20162e67c4d46?d=mp&s=160"},"body":"Signed-off-by: Matthias Kestenholz <mk@spinlock.ch>\n---\n\n\tThis patch adds color.ui support for scripts. It does that by\n\tmodifying `git config --get-colorbool`, because there is no\n\tway to differentiate between undefined and `false` configuration\n\tvariables in scripts. Additionally, the scripts don't need to be\n\tchanged. I have only tested git add -i; git svn uses the same\n\tfunctions in Git.pm, so it should work too.\n\n\tOf course, it would have been nicer if I had made this change\n\tbefore the release of 1.5.5. The 1.5.5 announcement reminded\n\tme, that this had yet to be done.\n\n Documentation/git-config.txt |    2 ++\n builtin-config.c             |    6 +++++-\n 2 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\nindex fa16171..5de5d05 100644\n--- a/Documentation/git-config.txt\n+++ b/Documentation/git-config.txt\n@@ -144,6 +144,8 @@ See also <<FILES>>.\n \t\"auto\".  If `stdout-is-tty` is missing, then checks the standard\n \toutput of the command itself, and exits with status 0 if color\n \tis to be used, or exits with status 1 otherwise.\n+\tWhen the color setting for `name` is undefined, the command uses\n+\t`color.ui` as fallback.\n \n --get-color name default::\n \ndiff --git a/builtin-config.c b/builtin-config.c\nindex c34bc8b..eccb7e7 100644\n--- a/builtin-config.c\n+++ b/builtin-config.c\n@@ -224,6 +224,10 @@ static int git_get_colorbool_config(const char *var, const char *value)\n \t\tget_diff_color_found =\n \t\t\tgit_config_colorbool(var, value, stdout_is_tty);\n \t}\n+\tif (!strcmp(var, \"color.ui\")) {\n+\t\tgit_use_color_default = git_config_colorbool(var, value, stdout_is_tty);\n+\t\treturn 0;\n+\t}\n \treturn 0;\n }\n \n@@ -251,7 +255,7 @@ static int get_colorbool(int argc, const char **argv)\n \t\tif (!strcmp(get_color_slot, \"color.diff\"))\n \t\t\tget_colorbool_found = get_diff_color_found;\n \t\tif (get_colorbool_found < 0)\n-\t\t\tget_colorbool_found = 0;\n+\t\t\tget_colorbool_found = git_use_color_default;\n \t}\n \n \tif (argc == 1) {\n-- \n1.5.5.24.g0eec3.dirty\n"}]}