public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag•fr>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org
Subject: Re: [RFC] Clean way to disable pager
Date: Sun, 19 Aug 2007 21:44:02 +0200	[thread overview]
Message-ID: <vpq643bz4vx.fsf@bauges.imag.fr> (raw)
In-Reply-To: <7vodh3bbmx.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Sun\, 19 Aug 2007 11\:52\:06 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> Please resend an applyable patch with a sign-off (and acked-by
> as you have seen).

>From 2c79b9a1b446ca9fa9d72fc595120da34fd403dd Mon Sep 17 00:00:00 2001
From: Matthieu Moy <Matthieu.Moy@imag•fr>
Date: Sun, 19 Aug 2007 19:24:36 +0200
Subject: [PATCH] Add and document a global --no-pager option for git.

To keep the change small, this is done by setting GIT_PAGER to "cat".

Acked-by: Linus Torvalds <torvalds@linux-foundation•org>
Acked-by: Brian Gernhardt <benji@silverinsanity•com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag•fr>
---
 Documentation/git.txt |    6 +++++-
 git.c                 |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 8017997..707a756 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -9,7 +9,8 @@ git - the stupid content tracker
 SYNOPSIS
 --------
 [verse]
-'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
+'git' [--version] [--exec-path[=GIT_EXEC_PATH]] 
+    [-p|--paginate] [--no-pager]
     [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
     [--help] COMMAND [ARGS]
 
@@ -103,6 +104,9 @@ OPTIONS
 -p|--paginate::
        Pipe all output into 'less' (or if set, $PAGER).
 
+--no-pager::
+       Do not pipe git output into a pager.
+
 --git-dir=<path>::
        Set the path to the repository. This can also be controlled by
        setting the GIT_DIR environment variable.
diff --git a/git.c b/git.c
index cab0e72..f280e7d 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" );
-- 
1.5.3.rc0.64.gf4f4a-dirty



-- 
Matthieu

  reply	other threads:[~2007-08-19 19:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-19 17:26 [RFC] Clean way to disable pager Matthieu Moy
2007-08-19 17:41 ` Matthieu Moy
2007-08-19 17:52 ` Linus Torvalds
2007-08-19 18:24 ` Brian Gernhardt
2007-08-19 18:52 ` Junio C Hamano
2007-08-19 19:44   ` Matthieu Moy [this message]
2007-08-19 21:59     ` Adam Roben
2007-08-19 22:37       ` David Kastrup
2007-08-20  8:15         ` Matthieu Moy
2007-08-21  2:11           ` Jakub Narebski
2007-08-21  8:37             ` [PATCH] Replace git --paginate by git --pager[=PAGER_CMD] Matthieu Moy
2007-08-21  8:42               ` Johannes Schindelin
2007-08-21  8:51                 ` Matthieu Moy
2007-08-21  9:19                   ` David Kastrup
2007-08-19 21:28 ` [RFC] Clean way to disable pager Alex Riesen

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=vpq643bz4vx.fsf@bauges.imag.fr \
    --to=matthieu.moy@imag$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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