Skip to content

Commit 4d4f5ba

Browse files
matthiaskgitster
authored andcommitted
Use color.ui variable in scripts too
Signed-off-by: Matthias Kestenholz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7134973 commit 4d4f5ba

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
@@ -224,6 +224,10 @@ static int git_get_colorbool_config(const char *var, const char *value)
224224
get_diff_color_found =
225225
git_config_colorbool(var, value, stdout_is_tty);
226226
}
227+
if (!strcmp(var, "color.ui")) {
228+
git_use_color_default = git_config_colorbool(var, value, stdout_is_tty);
229+
return 0;
230+
}
227231
return 0;
228232
}
229233

@@ -251,7 +255,7 @@ static int get_colorbool(int argc, const char **argv)
251255
if (!strcmp(get_color_slot, "color.diff"))
252256
get_colorbool_found = get_diff_color_found;
253257
if (get_colorbool_found < 0)
254-
get_colorbool_found = 0;
258+
get_colorbool_found = git_use_color_default;
255259
}
256260

257261
if (argc == 1) {

0 commit comments

Comments
 (0)