@matheusbsbs / matheus-bagliano / commits / 4d4f5ba3ea
Fork 0

Use color.ui variable in scripts too

Signed-off-by: Matthias Kestenholz <mk@spinlock.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthias Kestenholz committed Apr 9, 2008 at 21:32 UTC 4d4f5ba3ea9d22137f86f1d8e574a667e76e45bf
2 files changed +7 -1
Documentation/git-config.txt
+2
@@ -144,6 +144,8 @@ See also <<FILES>>.
144 "auto". If `stdout-is-tty` is missing, then checks the standard
145 output of the command itself, and exits with status 0 if color
146 is to be used, or exits with status 1 otherwise.
147 + When the color setting for `name` is undefined, the command uses
148 + `color.ui` as fallback.
149
150 --get-color name default::
151
builtin-config.c
+5 -1
@@ -224,6 +224,10 @@ static int git_get_colorbool_config(const char *var, const char *value)
224 get_diff_color_found =
225 git_config_colorbool(var, value, stdout_is_tty);
226 }
227 + if (!strcmp(var, "color.ui")) {
228 + git_use_color_default = git_config_colorbool(var, value, stdout_is_tty);
229 + return 0;
230 + }
231 return 0;
232 }
233
@@ -251,7 +255,7 @@ static int get_colorbool(int argc, const char **argv)
255 if (!strcmp(get_color_slot, "color.diff"))
256 get_colorbool_found = get_diff_color_found;
257 if (get_colorbool_found < 0)
254 - get_colorbool_found = 0;
258 + get_colorbool_found = git_use_color_default;
259 }
260
261 if (argc == 1) {