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>
This commit is contained in:
parent
9590b041ea
commit
aa086eb813
@ -116,6 +116,10 @@ apply.whitespace::
|
|||||||
Tells `git-apply` how to handle whitespaces, in the same way
|
Tells `git-apply` how to handle whitespaces, in the same way
|
||||||
as the '--whitespace' option. See gitlink:git-apply[1].
|
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::
|
diff.color::
|
||||||
When true (or `always`), always use colors in patch.
|
When true (or `always`), always use colors in patch.
|
||||||
When false (or `never`), never. When set to `auto`, use
|
When false (or `never`), never. When set to `auto`, use
|
||||||
|
1
cache.h
1
cache.h
@ -386,6 +386,7 @@ extern int receive_keep_pack(int fd[2], const char *me, int quiet, int);
|
|||||||
/* pager.c */
|
/* pager.c */
|
||||||
extern void setup_pager(void);
|
extern void setup_pager(void);
|
||||||
extern int pager_in_use;
|
extern int pager_in_use;
|
||||||
|
extern int pager_use_color;
|
||||||
|
|
||||||
/* base85 */
|
/* base85 */
|
||||||
int decode_85(char *dst, char *line, int linelen);
|
int decode_85(char *dst, char *line, int linelen);
|
||||||
|
5
config.c
5
config.c
@ -309,6 +309,11 @@ int git_default_config(const char *var, const char *value)
|
|||||||
return 0;
|
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. */
|
/* Add other config variables here and to Documentation/config.txt. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
2
diff.c
2
diff.c
@ -175,7 +175,7 @@ int git_diff_ui_config(const char *var, const char *value)
|
|||||||
diff_use_color_default = 1; /* bool */
|
diff_use_color_default = 1; /* bool */
|
||||||
else if (!strcasecmp(value, "auto")) {
|
else if (!strcasecmp(value, "auto")) {
|
||||||
diff_use_color_default = 0;
|
diff_use_color_default = 0;
|
||||||
if (isatty(1) || pager_in_use) {
|
if (isatty(1) || (pager_in_use && pager_use_color)) {
|
||||||
char *term = getenv("TERM");
|
char *term = getenv("TERM");
|
||||||
if (term && strcmp(term, "dumb"))
|
if (term && strcmp(term, "dumb"))
|
||||||
diff_use_color_default = 1;
|
diff_use_color_default = 1;
|
||||||
|
@ -23,6 +23,7 @@ int shared_repository = PERM_UMASK;
|
|||||||
const char *apply_default_whitespace = NULL;
|
const char *apply_default_whitespace = NULL;
|
||||||
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
|
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
|
||||||
int pager_in_use;
|
int pager_in_use;
|
||||||
|
int pager_use_color = 1;
|
||||||
|
|
||||||
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
|
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
|
||||||
*git_graft_file;
|
*git_graft_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user