git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Tim Olsen <tim@brooklynpenguin.com>
Cc: git@vger.kernel.org
Subject: Re: fatal output from git-show really wants a terminal
Date: Wed, 10 Dec 2008 20:46:50 +0100	[thread overview]
Message-ID: <200812102046.50186.j6t@kdbg.org> (raw)
In-Reply-To: <ghop5d$qud$1@ger.gmane.org>

On Mittwoch, 10. Dezember 2008, Tim Olsen wrote:
> It appears that when outputting a fatal error, git-show will choose
> stdout over stderr if stdout is a terminal and stderr is not.

This is by design.

> How do I 
> redirect the error but still allow stdout to be displayed?

$ git show 12345 2> /dev/null | less

> ~/git$ mkdir test
> ~/git$ cd test
> ~/git/test$ git init
> ~/git/test$ git show 12345
> fatal: ambiguous argument '12345': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions

You see this through the pager.

> ~/git/test$ git show 12345 2> /dev/null
> fatal: ambiguous argument '12345': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions

And this went through the pager as well.

> ~/git/test$ git show 12345 > /dev/null
> fatal: ambiguous argument '12345': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions

This went straight to the terminal.

The pattern is that if stdout is a terminal, the pager is thrown up and both 
stdout and stderr of git show proper are redirected to the pager. If you 
redirect only stderr, then this redirection is actually ignored.

-- Hannes

  parent reply	other threads:[~2008-12-10 19:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10 16:01 fatal output from git-show really wants a terminal Tim Olsen
2008-12-10 16:10 ` Boyd Stephen Smith Jr.
2008-12-10 19:46 ` Johannes Sixt [this message]
2008-12-10 20:10   ` Tim Olsen
2008-12-10 22:24   ` Boyd Stephen Smith Jr.
     [not found]     ` <alpine.DEB.1.00.0812111015140.18321@eeepc-johanness>
2008-12-11 16:51       ` Boyd Stephen Smith Jr.
2008-12-11 21:55         ` Jeff King
2008-12-11 22:45           ` Boyd Stephen Smith Jr.
2008-12-11 22:59             ` Jeff King
2008-12-11 23:03             ` Junio C Hamano
2008-12-15  8:15               ` Junio C Hamano
2008-12-15  8:23                 ` Junio C Hamano
2008-12-15  8:25                 ` Jeff King

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=200812102046.50186.j6t@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=tim@brooklynpenguin.com \
    /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).