aboutsummaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2007-08-19 19:24:36 +0200
committerJunio C Hamano <gitster@pobox.com>2007-08-19 14:38:45 -0700
commit463a849d004b2a3f3c8254b1e7985d4e986b9f1a (patch)
tree80233155b1a939f7c0e30ad6bb77ca3197e3d04d /git.c
parent2f82f760e1b2630073a05c44fe70bdce9706d9e5 (diff)
downloadgit-463a849d004b2a3f3c8254b1e7985d4e986b9f1a.tar.gz
git-463a849d004b2a3f3c8254b1e7985d4e986b9f1a.tar.xz
Add and document a global --no-pager option for git.
To keep the change small, this is done by setting GIT_PAGER to "cat". Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r--git.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/git.c b/git.c
index cab0e7227..c46691e97 100644
--- a/git.c
+++ b/git.c
@@ -4,7 +4,7 @@
#include "quote.h"
const char git_usage_string[] =
- "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
+ "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
static void prepend_to_path(const char *dir, int len)
{
@@ -58,6 +58,10 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
}
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
setup_pager();
+ } else if (!strcmp(cmd, "--no-pager")) {
+ setenv("GIT_PAGER", "cat", 1);
+ if (envchanged)
+ *envchanged = 1;
} else if (!strcmp(cmd, "--git-dir")) {
if (*argc < 2) {
fprintf(stderr, "No directory given for --git-dir.\n" );