Skip to content

Commit

Permalink
Add core.pager config variable.
Browse files Browse the repository at this point in the history
This adds a configuration variable that performs the same function as,
but is overridden by, GIT_PAGER.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Acked-by: Johannes E. Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Gernhardt authored and Junio C Hamano committed Jul 4, 2007
1 parent 41c7c1b commit 54adf37
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ core.excludesfile::
of files which are not meant to be tracked. See
gitlink:gitignore[5].

core.pager::
The command that git will use to paginate output. Can be overridden
with the `GIT_PAGER` environment variable.

alias.*::
Command aliases for the gitlink:git[1] command wrapper - e.g.
after defining "alias.last = cat-file commit HEAD", the invocation
Expand Down
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char

/* pager.c */
extern void setup_pager(void);
extern char *pager_program;
extern int pager_in_use;
extern int pager_use_color;

Expand Down
5 changes: 5 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ int git_default_config(const char *var, const char *value)
return 0;
}

if (!strcmp(var, "core.pager")) {
pager_program = xstrdup(value);
return 0;
}

/* Add other config variables here and to Documentation/config.txt. */
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int core_compression_seen;
size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
size_t delta_base_cache_limit = 16 * 1024 * 1024;
char *pager_program;
int pager_in_use;
int pager_use_color = 1;
int auto_crlf = 0; /* 1: both ways, -1: only when adding git objects */
Expand Down
2 changes: 2 additions & 0 deletions pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ void setup_pager(void)

if (!isatty(1))
return;
if (!pager)
pager = pager_program;
if (!pager)
pager = getenv("PAGER");
if (!pager)
Expand Down

0 comments on commit 54adf37

Please sign in to comment.