All of lore.kernel.org
 help / color / mirror / Atom feed
* git push output goes into stderr
@ 2011-09-04  9:26 Lynn Lin
  2011-09-05  0:57 ` Junio C Hamano
  2011-09-05  4:39 ` Sitaram Chamarty
  0 siblings, 2 replies; 8+ messages in thread
From: Lynn Lin @ 2011-09-04  9:26 UTC (permalink / raw)
  To: git

Hi all,
When I create a local branch and then push it to remote. I find that
the output without error goes into stderr, is this expected?

Lynn

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-04  9:26 git push output goes into stderr Lynn Lin
@ 2011-09-05  0:57 ` Junio C Hamano
  2011-09-06  7:49   ` Clemens Buchacher
  2011-09-05  4:39 ` Sitaram Chamarty
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2011-09-05  0:57 UTC (permalink / raw)
  To: Lynn Lin; +Cc: git

Lynn Lin <lynn.xin.lin@gmail.com> writes:

> When I create a local branch and then push it to remote. I find that
> the output without error goes into stderr, is this expected?

Progress output are sent to the stderr stream.

In general, any program or script is buggy if it assumes that some output
that are emitted to the standard error output from programs it invokes
indicates an error (IIRC, that includes tcl/tk).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-04  9:26 git push output goes into stderr Lynn Lin
  2011-09-05  0:57 ` Junio C Hamano
@ 2011-09-05  4:39 ` Sitaram Chamarty
  1 sibling, 0 replies; 8+ messages in thread
From: Sitaram Chamarty @ 2011-09-05  4:39 UTC (permalink / raw)
  To: Lynn Lin; +Cc: git

On Sun, Sep 4, 2011 at 2:56 PM, Lynn Lin <lynn.xin.lin@gmail.com> wrote:
> Hi all,
> When I create a local branch and then push it to remote. I find that
> the output without error goes into stderr, is this expected?

when the two sides of the conversation have an established protocol to
talk to each other and exchange data, any extraneous stuff (progress
message, tracing/debugging logs...) will confuse the protocol.
Shunting that aside to STDERR helps avoid protocol confusion.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-05  0:57 ` Junio C Hamano
@ 2011-09-06  7:49   ` Clemens Buchacher
  2011-09-07 21:57     ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Clemens Buchacher @ 2011-09-06  7:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Lynn Lin, git

On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:
> Lynn Lin <lynn.xin.lin@gmail.com> writes:
> 
> > When I create a local branch and then push it to remote. I find that
> > the output without error goes into stderr, is this expected?
> 
> Progress output are sent to the stderr stream.

But it's not only progress output that goes to stderr in case of
git push. Even the summary written in tranport_print_push_status
goes to stderr, unless we specify git push --porcelain. Can't we
let that part of the output go to stdout unconditionally?

Clemens

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-06  7:49   ` Clemens Buchacher
@ 2011-09-07 21:57     ` Jeff King
  2011-09-08  5:42       ` Sitaram Chamarty
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2011-09-07 21:57 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: Junio C Hamano, Lynn Lin, git

On Tue, Sep 06, 2011 at 09:49:16AM +0200, Clemens Buchacher wrote:

> On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:
> > Lynn Lin <lynn.xin.lin@gmail.com> writes:
> > 
> > > When I create a local branch and then push it to remote. I find that
> > > the output without error goes into stderr, is this expected?
> > 
> > Progress output are sent to the stderr stream.
> 
> But it's not only progress output that goes to stderr in case of
> git push. Even the summary written in tranport_print_push_status
> goes to stderr, unless we specify git push --porcelain. Can't we
> let that part of the output go to stdout unconditionally?

We could, though it makes more sense on stderr to me.

Stdout has always been about "the main program output" and stderr about
diagnostic messages. With a program whose main function is to generate
output (e.g., "git tag -l", it's very easy to know that the list of tags
is the main program output (which you don't want to pollute with
anything else), and any problems or even general chattiness goes to
stderr.

But with a program whose main function is to perform an action, like
"git push", I think there are really two ways to look at it:

  1. There is no main output; any progress or status update is just
     diagnostic chat, and should go to stderr.

  2. The main output is the status report; it goes to stdout, and
     progress updates go to stderr.

I think both are equally valid mental models, and both are consistent
with the philosophy above. If we switch, I wouldn't be surprised to see
somebody say "why is this going to stdout, it should be on stderr". In
fact, I seem to recall that we've had this discussion before on the
list.

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-07 21:57     ` Jeff King
@ 2011-09-08  5:42       ` Sitaram Chamarty
  2011-09-08  7:07         ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Sitaram Chamarty @ 2011-09-08  5:42 UTC (permalink / raw)
  To: Jeff King; +Cc: Clemens Buchacher, Junio C Hamano, Lynn Lin, git

On Thu, Sep 8, 2011 at 3:27 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Sep 06, 2011 at 09:49:16AM +0200, Clemens Buchacher wrote:
>
>> On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:
>> > Lynn Lin <lynn.xin.lin@gmail.com> writes:
>> >
>> > > When I create a local branch and then push it to remote. I find that
>> > > the output without error goes into stderr, is this expected?
>> >
>> > Progress output are sent to the stderr stream.
>>
>> But it's not only progress output that goes to stderr in case of
>> git push. Even the summary written in tranport_print_push_status
>> goes to stderr, unless we specify git push --porcelain. Can't we
>> let that part of the output go to stdout unconditionally?
>
> We could, though it makes more sense on stderr to me.
>
> Stdout has always been about "the main program output" and stderr about
> diagnostic messages. With a program whose main function is to generate
> output (e.g., "git tag -l", it's very easy to know that the list of tags
> is the main program output (which you don't want to pollute with
> anything else), and any problems or even general chattiness goes to
> stderr.
>
> But with a program whose main function is to perform an action, like
> "git push", I think there are really two ways to look at it:
>
>  1. There is no main output; any progress or status update is just
>     diagnostic chat, and should go to stderr.
>
>  2. The main output is the status report; it goes to stdout, and
>     progress updates go to stderr.

I always thought if you write stuff to stdout the remote client gets
confused because it is executing to a defined protocol and suddenly
sees unexpected input in the middle.

Bit if *you* are saying this (output random stuff to STDOUT) can
happen if we want it to, clearly I was wrong...

> I think both are equally valid mental models, and both are consistent
> with the philosophy above. If we switch, I wouldn't be surprised to see
> somebody say "why is this going to stdout, it should be on stderr". In
> fact, I seem to recall that we've had this discussion before on the
> list.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-08  5:42       ` Sitaram Chamarty
@ 2011-09-08  7:07         ` Jeff King
  2011-09-08  8:24           ` Sitaram Chamarty
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2011-09-08  7:07 UTC (permalink / raw)
  To: Sitaram Chamarty; +Cc: Clemens Buchacher, Junio C Hamano, Lynn Lin, git

On Thu, Sep 08, 2011 at 11:12:48AM +0530, Sitaram Chamarty wrote:

> > But with a program whose main function is to perform an action, like
> > "git push", I think there are really two ways to look at it:
> >
> >  1. There is no main output; any progress or status update is just
> >     diagnostic chat, and should go to stderr.
> >
> >  2. The main output is the status report; it goes to stdout, and
> >     progress updates go to stderr.
> 
> I always thought if you write stuff to stdout the remote client gets
> confused because it is executing to a defined protocol and suddenly
> sees unexpected input in the middle.
> 
> Bit if *you* are saying this (output random stuff to STDOUT) can
> happen if we want it to, clearly I was wrong...

For the remote side, yes, we have to be sure not to pollute stdout,
because that's where the protocol is going.. But the status table is
generated on the client side, so stdout is just connected to the user's
terminal there.

We already generate --porcelain status output from push on stdout (and
again, that makes sense to me philosophically, because the user is
asking push to generate the output). So it's clearly not a big deal.
It's just a matter of taste.

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: git push output goes into stderr
  2011-09-08  7:07         ` Jeff King
@ 2011-09-08  8:24           ` Sitaram Chamarty
  0 siblings, 0 replies; 8+ messages in thread
From: Sitaram Chamarty @ 2011-09-08  8:24 UTC (permalink / raw)
  To: Jeff King; +Cc: Clemens Buchacher, Junio C Hamano, Lynn Lin, git

On Thu, Sep 8, 2011 at 12:37 PM, Jeff King <peff@peff.net> wrote:
> On Thu, Sep 08, 2011 at 11:12:48AM +0530, Sitaram Chamarty wrote:
>
>> > But with a program whose main function is to perform an action, like
>> > "git push", I think there are really two ways to look at it:
>> >
>> >  1. There is no main output; any progress or status update is just
>> >     diagnostic chat, and should go to stderr.
>> >
>> >  2. The main output is the status report; it goes to stdout, and
>> >     progress updates go to stderr.
>>
>> I always thought if you write stuff to stdout the remote client gets
>> confused because it is executing to a defined protocol and suddenly
>> sees unexpected input in the middle.
>>
>> Bit if *you* are saying this (output random stuff to STDOUT) can
>> happen if we want it to, clearly I was wrong...
>
> For the remote side, yes, we have to be sure not to pollute stdout,
> because that's where the protocol is going.. But the status table is
> generated on the client side, so stdout is just connected to the user's
> terminal there.

 aah ok, that makes sense; thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-08  8:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-04  9:26 git push output goes into stderr Lynn Lin
2011-09-05  0:57 ` Junio C Hamano
2011-09-06  7:49   ` Clemens Buchacher
2011-09-07 21:57     ` Jeff King
2011-09-08  5:42       ` Sitaram Chamarty
2011-09-08  7:07         ` Jeff King
2011-09-08  8:24           ` Sitaram Chamarty
2011-09-05  4:39 ` Sitaram Chamarty

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.