pager: config variable pager.color
enable/disable colored output when the pager is in use Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Matthias Lederhofer committed
Jul 30, 2006 at 00:27 UTC
aa086eb813d4fe21aac556a94efe5e29b44d8ca4
5 files changed
+12
-1
Documentation/config.txt
+4
@@ -116,6 +116,10 @@ apply.whitespace::
116
Tells `git-apply` how to handle whitespaces, in the same way
117
as the '--whitespace' option. See gitlink:git-apply[1].
118
119
+pager.color::
120
+ A boolean to enable/disable colored output when the pager is in
121
+ use (default is true).
122
+
123
diff.color::
124
When true (or `always`), always use colors in patch.
125
When false (or `never`), never. When set to `auto`, use
cache.h
+1
@@ -386,6 +386,7 @@ extern int receive_keep_pack(int fd[2], const char *me, int quiet, int);
386
/* pager.c */
387
extern void setup_pager(void);
388
extern int pager_in_use;
389
+extern int pager_use_color;
390
391
/* base85 */
392
int decode_85(char *dst, char *line, int linelen);
config.c
+5
@@ -309,6 +309,11 @@ int git_default_config(const char *var, const char *value)
309
return 0;
310
}
311
312
+ if (!strcmp(var, "pager.color")) {
313
+ pager_use_color = git_config_bool(var,value);
314
+ return 0;
315
+ }
316
+
317
/* Add other config variables here and to Documentation/config.txt. */
318
return 0;
319
}
diff.c
+1
-1
@@ -175,7 +175,7 @@ int git_diff_ui_config(const char *var, const char *value)
175
diff_use_color_default = 1; /* bool */
176
else if (!strcasecmp(value, "auto")) {
177
diff_use_color_default = 0;
178
- if (isatty(1) || pager_in_use) {
178
+ if (isatty(1) || (pager_in_use && pager_use_color)) {
179
char *term = getenv("TERM");
180
if (term && strcmp(term, "dumb"))
181
diff_use_color_default = 1;
environment.c
+1
@@ -23,6 +23,7 @@ int shared_repository = PERM_UMASK;
23
const char *apply_default_whitespace = NULL;
24
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
25
int pager_in_use;
26
+int pager_use_color = 1;
27
28
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
29
*git_graft_file;