Skip to content

Commit dc46fa3

Browse files
committed
Merge branch 'mk/color'
* mk/color: Use color.ui variable in scripts too
2 parents 8876046 + 4d4f5ba commit dc46fa3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Documentation/git-config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ See also <<FILES>>.
144144
"auto". If `stdout-is-tty` is missing, then checks the standard
145145
output of the command itself, and exits with status 0 if color
146146
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.
147149

148150
--get-color name default::
149151

builtin-config.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ static int git_get_colorbool_config(const char *var, const char *value)
240240
get_diff_color_found =
241241
git_config_colorbool(var, value, stdout_is_tty);
242242
}
243+
if (!strcmp(var, "color.ui")) {
244+
git_use_color_default = git_config_colorbool(var, value, stdout_is_tty);
245+
return 0;
246+
}
243247
return 0;
244248
}
245249

@@ -267,7 +271,7 @@ static int get_colorbool(int argc, const char **argv)
267271
if (!strcmp(get_color_slot, "color.diff"))
268272
get_colorbool_found = get_diff_color_found;
269273
if (get_colorbool_found < 0)
270-
get_colorbool_found = 0;
274+
get_colorbool_found = git_use_color_default;
271275
}
272276

273277
if (argc == 1) {

0 commit comments

Comments
 (0)