# Should "git help" respect the 'pager' setting?

7 messages from 2013-05-30 to 2013-06-02. Participants: Michael Campbell, Matthieu Moy, Ramkumar Ramachandra, John Keeping, Junio C Hamano.
Thread: https://gitlist.dev/t/33992

## Michael Campbell, 2013-05-30 16:33

Subject: Should "git help" respect the 'pager' setting?
Message-ID: <CAKtB=OCyoN8ECYiAzXc3UiCrLfWn7Pq7_5CSQUjJ2dhbzQ2RsQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAKtB%3DOCyoN8ECYiAzXc3UiCrLfWn7Pq7_5CSQUjJ2dhbzQ2RsQ%40mail.gmail.com

```
I have my global git config pager set to 'cat', but when I do a "git
help <command>", it still uses a pager.  This is especially irksome in
emacs shell buffers, where I am most of the time.  I know I can do a
M-x man -> git-<whatever>, but wondered if this was a bug or user
error.  ("git --no-pager help <command>" does the same.)


12:31 [mcampbell] /tmp  % git --no-pager help log
WARNING: terminal is not fully functional
-  (press RETURN)

```

## Matthieu Moy, 2013-05-30 16:42

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <vpqtxlko1vn.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqtxlko1vn.fsf%40anie.imag.fr
In-Reply-To: <CAKtB=OCyoN8ECYiAzXc3UiCrLfWn7Pq7_5CSQUjJ2dhbzQ2RsQ@mail.gmail.com>

```
Michael Campbell <michael.campbell@gmail.com> writes:

> I have my global git config pager set to 'cat', but when I do a "git
> help <command>", it still uses a pager.  This is especially irksome in
> emacs shell buffers, where I am most of the time.  I know I can do a
> M-x man -> git-<whatever>, but wondered if this was a bug or user
> error.  ("git --no-pager help <command>" does the same.)

"git help foo" just calls "man git-foo" by default, so what happens is
the same as if you called "man git-foo" by hand. Git does not have
much control over what man will do, it could probably call "man -P
$pager" when the Git pager is set, but I'd find it a bit weird.

If you're an Emacs user, you can read about man.viewer and set it to
woman, or set PAGER=cat when inside Emacs.

I personally run M-x git-foo RET, and never run "git help".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Ramkumar Ramachandra, 2013-05-30 16:56

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <CALkWK0=RUy6=4k9uGpy2efdL8DhOnNO52rHZWSmHP3C=2a4SUw@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0%3DRUy6%3D4k9uGpy2efdL8DhOnNO52rHZWSmHP3C%3D2a4SUw%40mail.gmail.com
In-Reply-To: <vpqtxlko1vn.fsf@anie.imag.fr>

```
Matthieu Moy wrote:
> Michael Campbell <michael.campbell@gmail.com> writes:
>> I have my global git config pager set to 'cat', but when I do a "git
>> help <command>", it still uses a pager.  This is especially irksome in
>> emacs shell buffers, where I am most of the time.  I know I can do a
>> M-x man -> git-<whatever>, but wondered if this was a bug or user
>> error.  ("git --no-pager help <command>" does the same.)
>
> "git help foo" just calls "man git-foo" by default, so what happens is
> the same as if you called "man git-foo" by hand. Git does not have
> much control over what man will do, it could probably call "man -P
> $pager" when the Git pager is set, but I'd find it a bit weird.

It just needs to set $PAGER or $MANPAGER before the exec(), no?  I
would argue that it should do this.  $GIT_PAGER works everywhere else,
but obviously man has no knowledge about it.

> If you're an Emacs user, you can read about man.viewer and set it to
> woman, or set PAGER=cat when inside Emacs.

I just learnt about man.viewer.  There's a small problem with it
though: why is there no option for Emacs man corresponding to Emacs
woman?

> I personally run M-x git-foo RET, and never run "git help".

M-x man git-foo RET, you mean?  My style is slightly different: I love
typing out 'man git log' on the terminal (dashless); I get it to open
in an Emacs buffer using this hack:

function man_ () {
	emacsclient -e "(man \"$*\")" 2>&1 >/dev/null || man "$*"
}

alias man=man_

```

## Matthieu Moy, 2013-05-30 17:05

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <vpqhahko0ub.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqhahko0ub.fsf%40anie.imag.fr
In-Reply-To: <CALkWK0=RUy6=4k9uGpy2efdL8DhOnNO52rHZWSmHP3C=2a4SUw@mail.gmail.com>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:

> It just needs to set $PAGER or $MANPAGER before the exec(), no?

Yes, that should do the same as "man -P".

> I would argue that it should do this. $GIT_PAGER works everywhere
> else, but obviously man has no knowledge about it.

I find it a bit weird that Git sets the configuration for external
commands, but it may make sense. No strong opinion here.

>> If you're an Emacs user, you can read about man.viewer and set it to
>> woman, or set PAGER=cat when inside Emacs.
>
> I just learnt about man.viewer.  There's a small problem with it
> though: why is there no option for Emacs man corresponding to Emacs
> woman?

I guess because no one implemented it ;-).

>> I personally run M-x git-foo RET, and never run "git help".
>
> M-x man git-foo RET, you mean?

Yes, sorry.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Ramkumar Ramachandra, 2013-05-30 17:08

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <CALkWK0ns3iVATnPwZ4OFJUxefyE6j-ayV3-iwh3Wr9FBZJyt1g@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0ns3iVATnPwZ4OFJUxefyE6j-ayV3-iwh3Wr9FBZJyt1g%40mail.gmail.com
In-Reply-To: <vpqhahko0ub.fsf@anie.imag.fr>

```
Matthieu Moy wrote:
> I find it a bit weird that Git sets the configuration for external
> commands, but it may make sense. No strong opinion here.

I don't mean a setenv() kind of thing: how would we unset it after
that?  Perhaps something like execvpe(), passing in the environment as
an argument?

```

## John Keeping, 2013-05-30 17:14

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <20130530171431.GF17475@serenity.lan>
URL: https://gitlist.dev/e/20130530171431.GF17475%40serenity.lan
In-Reply-To: <CALkWK0ns3iVATnPwZ4OFJUxefyE6j-ayV3-iwh3Wr9FBZJyt1g@mail.gmail.com>

```
On Thu, May 30, 2013 at 10:38:59PM +0530, Ramkumar Ramachandra wrote:
> Matthieu Moy wrote:
> > I find it a bit weird that Git sets the configuration for external
> > commands, but it may make sense. No strong opinion here.
> 
> I don't mean a setenv() kind of thing: how would we unset it after
> that?  Perhaps something like execvpe(), passing in the environment as
> an argument?

Overriding PAGER might make sense, but I'd be quite annoyed if Git
decided to override MANPAGER without providing some way to override it.

If a user sets MANPAGER then it's because they want a specific pager
when reading man pages - invoking man through "git help" shouldn't cause
it to behave differently in this case.

```

## Junio C Hamano, 2013-06-02 22:24

Subject: Re: Should "git help" respect the 'pager' setting?
Message-ID: <7va9n8m9rq.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7va9n8m9rq.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20130530171431.GF17475@serenity.lan>

```
John Keeping <john@keeping.me.uk> writes:

> On Thu, May 30, 2013 at 10:38:59PM +0530, Ramkumar Ramachandra wrote:
>> Matthieu Moy wrote:
>> > I find it a bit weird that Git sets the configuration for external
>> > commands, but it may make sense. No strong opinion here.
>> 
>> I don't mean a setenv() kind of thing: how would we unset it after
>> that?  Perhaps something like execvpe(), passing in the environment as
>> an argument?

Running "man" is the last thing we do before exitting "git help" and
exec_man_man() does seem to do execlp(), so I do not see it as an
issue.

> Overriding PAGER might make sense, but I'd be quite annoyed if Git
> decided to override MANPAGER without providing some way to override it.

Hmm, see below.

> If a user sets MANPAGER then it's because they want a specific pager
> when reading man pages - invoking man through "git help" shouldn't cause
> it to behave differently in this case.

True, and for that matter, if the user sets PAGER to use with
non-Git (including manual pages) and also sets GIT_PAGER to use
specifically with Git, the user would be annoyed if we passed
formatted manual pages to GIT_PAGER by exporting PAGER (or driving
"man" with its "-P" option).

```
