summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9590b04)
raw | patch | inline | side by side (parent: 9590b04)
author | Matthias Lederhofer <matled@gmx.net> | |
Sat, 29 Jul 2006 22:27:43 +0000 (00:27 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 31 Jul 2006 22:32:24 +0000 (15:32 -0700) |
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>
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/config.txt | patch | blob | history | |
cache.h | patch | blob | history | |
config.c | patch | blob | history | |
diff.c | patch | blob | history | |
environment.c | patch | blob | history |
index 465eb13e76dca5cf4daad9d5ea773f4743452c75..e669003f72de9be376f04847faf2a125c147491e 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
Tells `git-apply` how to handle whitespaces, in the same way
as the '--whitespace' option. See gitlink:git-apply[1].
+pager.color::
+ A boolean to enable/disable colored output when the pager is in
+ use (default is true).
+
diff.color::
When true (or `always`), always use colors in patch.
When false (or `never`), never. When set to `auto`, use
index c575b8a9962d4eec64e91b1b0df38e60b20df288..b8c21e07b2e714de8e4e662b31a41ff06c5e0c9a 100644 (file)
--- a/cache.h
+++ b/cache.h
/* pager.c */
extern void setup_pager(void);
extern int pager_in_use;
+extern int pager_use_color;
/* base85 */
int decode_85(char *dst, char *line, int linelen);
diff --git a/config.c b/config.c
index 0ac6aebbbcbd666d5bd8201ce28e1868bd6d5a30..82b35624543a2e50d80cafab15b63df0152adbc0 100644 (file)
--- a/config.c
+++ b/config.c
return 0;
}
+ if (!strcmp(var, "pager.color")) {
+ pager_use_color = git_config_bool(var,value);
+ return 0;
+ }
+
/* Add other config variables here and to Documentation/config.txt. */
return 0;
}
index 6a713764831e7521958f4b280f2e1d3911fb3cea..607c357f5ad8ff07c69dec7c185d667db4e43397 100644 (file)
--- a/diff.c
+++ b/diff.c
diff_use_color_default = 1; /* bool */
else if (!strcasecmp(value, "auto")) {
diff_use_color_default = 0;
- if (isatty(1) || pager_in_use) {
+ if (isatty(1) || (pager_in_use && pager_use_color)) {
char *term = getenv("TERM");
if (term && strcmp(term, "dumb"))
diff_use_color_default = 1;
diff --git a/environment.c b/environment.c
index 42f39d657ef0056667bb8814622e0dde2733e373..87162b257254434be356b1a579967d51adff1e5f 100644 (file)
--- a/environment.c
+++ b/environment.c
const char *apply_default_whitespace = NULL;
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
int pager_in_use;
+int pager_use_color = 1;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
*git_graft_file;