* [PATCH] Add pager.program config variable.
@ 2007-07-03 16:03 Brian Gernhardt
2007-07-03 16:30 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: Brian Gernhardt @ 2007-07-03 16:03 UTC (permalink / raw)
To: git
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>
---
This takes the last bit of git specific configuration out of my
.profile and puts it in .gitconfig where it belongs.
I didn't know what name to use. I settled on pager.program, but
thought that core.pager might be better since there are no other
options in the pager section.
Documentation/config.txt | 4 ++++
cache.h | 1 +
config.c | 5 +++++
environment.c | 1 +
| 2 ++
5 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1d96adf..1c4f3d5 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -596,6 +596,10 @@ pack.deltaCacheLimit::
The maxium size of a delta, that is cached in
gitlink:git-pack-objects[1]. Defaults to 1000.
+pager.program::
+ The command that git will use to page output. Can be overridden with
+ the `GIT_PAGER` environment variable.
+
pull.octopus::
The default merge strategy to use when pulling multiple branches
at once.
diff --git a/cache.h b/cache.h
index 0d23a25..e64071e 100644
--- a/cache.h
+++ b/cache.h
@@ -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;
diff --git a/config.c b/config.c
index 4de8926..146b4bd 100644
--- a/config.c
+++ b/config.c
@@ -387,6 +387,11 @@ int git_default_config(const char *var, const char *value)
return 0;
}
+ if (!strcmp(var, "pager.program")) {
+ pager_program = xstrdup(value);
+ return 0;
+ }
+
/* Add other config variables here and to Documentation/config.txt. */
return 0;
}
diff --git a/environment.c b/environment.c
index 1c2773f..f83fb9e 100644
--- a/environment.c
+++ b/environment.c
@@ -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 */
--git a/pager.c b/pager.c
index 5f280ab..3bfed02 100644
--- a/pager.c
+++ b/pager.c
@@ -32,6 +32,8 @@ void setup_pager(void)
if (!isatty(1))
return;
if (!pager)
+ pager = pager_program;
+ if (!pager)
pager = getenv("PAGER");
if (!pager)
pager = "less";
--
1.5.3.rc0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Add pager.program config variable.
2007-07-03 16:03 [PATCH] Add pager.program config variable Brian Gernhardt
@ 2007-07-03 16:30 ` Johannes Schindelin
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2007-07-03 16:30 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: git
Hi,
On Tue, 3 Jul 2007, Brian Gernhardt wrote:
> I didn't know what name to use. I settled on pager.program, but
> thought that core.pager might be better since there are no other
> options in the pager section.
Yeah, core.pager seems more consistent.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Add core.pager config variable.
2007-07-03 16:30 ` Johannes Schindelin
@ 2007-07-03 18:18 ` Brian Gernhardt
2007-07-03 18:39 ` Johannes Schindelin
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Brian Gernhardt @ 2007-07-03 18:18 UTC (permalink / raw)
To: git, Johannes Schindelin
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>
---
Since Johannes agrees, core.pager it is. :-)
Documentation/config.txt | 4 ++++
cache.h | 1 +
config.c | 5 +++++
environment.c | 1 +
| 2 ++
5 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1d96adf..d319359 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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 paginatee 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
diff --git a/cache.h b/cache.h
index 0d23a25..e64071e 100644
--- a/cache.h
+++ b/cache.h
@@ -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;
diff --git a/config.c b/config.c
index 4de8926..561ee3b 100644
--- a/config.c
+++ b/config.c
@@ -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;
}
diff --git a/environment.c b/environment.c
index 1c2773f..f83fb9e 100644
--- a/environment.c
+++ b/environment.c
@@ -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 */
--git a/pager.c b/pager.c
index 5f280ab..3bfed02 100644
--- a/pager.c
+++ b/pager.c
@@ -32,6 +32,8 @@ void setup_pager(void)
if (!isatty(1))
return;
if (!pager)
+ pager = pager_program;
+ if (!pager)
pager = getenv("PAGER");
if (!pager)
pager = "less";
--
1.5.3.rc0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Add core.pager config variable.
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
@ 2007-07-03 18:39 ` Johannes Schindelin
2007-07-03 19:42 ` Robin Rosenberg
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2007-07-03 18:39 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: git
Hi,
On Tue, 3 Jul 2007, Brian Gernhardt wrote:
> 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>
> ---
>
> Since Johannes agrees, core.pager it is. :-)
Acked-by: Johannes E. Schindelin <johannes.schindelin@gmx.de>
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add core.pager config variable.
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
2007-07-03 18:39 ` Johannes Schindelin
@ 2007-07-03 19:42 ` Robin Rosenberg
2007-07-03 19:50 ` Brian Gernhardt
2007-07-03 19:48 ` Jonas Fonseca
2007-07-04 5:10 ` Junio C Hamano
3 siblings, 1 reply; 8+ messages in thread
From: Robin Rosenberg @ 2007-07-03 19:42 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: git, Johannes Schindelin
tisdag 03 juli 2007 skrev Brian Gernhardt:
> This adds a configuration variable that performs the same function as,
> but is overridden by, GIT_PAGER.
[...]
> diff --git a/pager.c b/pager.c
> index 5f280ab..3bfed02 100644
> --- a/pager.c
> +++ b/pager.c
> @@ -32,6 +32,8 @@ void setup_pager(void)
> if (!isatty(1))
> return;
> if (!pager)
> + pager = pager_program;
> + if (!pager)
> pager = getenv("PAGER");
> if (!pager)
> pager = "less";
Nak.
PAGER cannot override core.pager with this.
-- robin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add core.pager config variable.
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
2007-07-03 18:39 ` Johannes Schindelin
2007-07-03 19:42 ` Robin Rosenberg
@ 2007-07-03 19:48 ` Jonas Fonseca
2007-07-04 5:10 ` Junio C Hamano
3 siblings, 0 replies; 8+ messages in thread
From: Jonas Fonseca @ 2007-07-03 19:48 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: git, Johannes Schindelin
On 7/3/07, Brian Gernhardt <benji@silverinsanity.com> wrote:
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 1d96adf..d319359 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -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 paginatee output. Can be overridden
> + with the `GIT_PAGER` environment variable.
> +
A typo: paginatee.
--
Jonas Fonseca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add core.pager config variable.
2007-07-03 19:42 ` Robin Rosenberg
@ 2007-07-03 19:50 ` Brian Gernhardt
0 siblings, 0 replies; 8+ messages in thread
From: Brian Gernhardt @ 2007-07-03 19:50 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git, Johannes Schindelin
On Jul 3, 2007, at 3:42 PM, Robin Rosenberg wrote:
> Nak.
>
> PAGER cannot override core.pager with this.
core.pager is acting exactly like GIT_PAGER. The priority goes (from
pager.c:30):
GIT_PAGER
core.pager
PAGER
"less"
I think this is a desirable option because I'd like to tell all other
programs to use less and tell git to use tig (which I'm trying out).
I specifically want core.pager to override PAGER, but this leaves
GIT_PAGER as the final override. Why should I export an environment
variable to every program when git has a configuration file? And
what does overriding PAGER break? If the user doesn't want to use
core.pager, they don't have to.
~~ Brian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add core.pager config variable.
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
` (2 preceding siblings ...)
2007-07-03 19:48 ` Jonas Fonseca
@ 2007-07-04 5:10 ` Junio C Hamano
3 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2007-07-04 5:10 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: git, Johannes Schindelin
Looks good, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-07-04 5:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03 16:03 [PATCH] Add pager.program config variable Brian Gernhardt
2007-07-03 16:30 ` Johannes Schindelin
2007-07-03 18:18 ` [PATCH] Add core.pager " Brian Gernhardt
2007-07-03 18:39 ` Johannes Schindelin
2007-07-03 19:42 ` Robin Rosenberg
2007-07-03 19:50 ` Brian Gernhardt
2007-07-03 19:48 ` Jonas Fonseca
2007-07-04 5:10 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).