git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gernhardt <benji@silverinsanity.com>
To: git@vger.kernel.org
Subject: [PATCH] Add pager.program config variable.
Date: Tue, 3 Jul 2007 12:03:08 -0400	[thread overview]
Message-ID: <20070703160308.GA16629@Hermes.local> (raw)

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 +
 pager.c                  |    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 */
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";
-- 
1.5.3.rc0

             reply	other threads:[~2007-07-03 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 16:03 Brian Gernhardt [this message]
2007-07-03 16:30 ` [PATCH] Add pager.program config variable 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070703160308.GA16629@Hermes.local \
    --to=benji@silverinsanity.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).