Gerrit Pape wrote:
> On Thu, Jan 25, 2007 at 08:29:09PM -0800, Josh Triplett wrote:
>> Gerrit Pape wrote:
>>> On Tue, Jan 16, 2007 at 09:06:58PM -0800, Josh Triplett wrote:
>>>> If you run git-log --pretty=foo, it fails with the message "fatal: invalid
>>>> --pretty format: foo", but it still opens a pager displaying no content.
>>> Hmm, it doesn't for me, neither with 1.4.4.4, nor with 1.4.4.3, can you
>>> please re-check?
>> I can still reproduce this.  Investigating more carefully, I found two
>> different failure modes, depending on the way you invoke log.  If you run
>> "git-log --pretty=foo", you get a pager containing the error message.  This
>> seems wrong, because git-log should not open a pager containing a one-line
>> error message; it should just print the error message on stderr.  If you run
>> "git log --pretty=foo" (note the space, rather than the dash), you get an
>> *empty* pager, and an error message at the terminal underneath the pager,
>> which you can see when you quit the pager.  In both cases, git{-, }log should
>> just print the error message to stderr and not open a pager.
> 
> You most probably use another pager than less.  Before forking the
> pager, the git tools set LESS=FRSX in the environment, where F means the
> -F option to less ("Causes less to automatically exit if the entire file
> can be displayed on the first screen").

I use less, and my pager alternative points to less.

However, I have $LESS set (to -R) in my environment already, and git calls
setenv with overwrite=0, so less never gets -F.  That explains part of the
observed behavior, though it doesn't explain the difference between git log
and git-log.

Why not just avoid starting the pager if an error (such as an invalid
argument) occurs?

> less is the default pager for git, I changed it to 'pager' for Debian,
> see #369742, maybe I should reverse that patch.

No, you definitely want to use the pager alternative, to follow the sysadmin's
choice for system pager if the user has no preference via $PAGER.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to