{"thread":{"id":"28296","subject":"git push output goes into stderr","startedAt":"2011-09-04T09:26:59Z","lastAt":"2011-09-08T08:24:00Z","messageCount":8,"participants":["Lynn Lin","Junio C Hamano","Sitaram Chamarty","Clemens Buchacher","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174801","messageId":"CAPgpnMQuck_aPU0ciaGgj-C8rno7jbzZ7wZ4unU8CqA0eaiYQw@mail.gmail.com","threadId":"28296","inReplyTo":null,"subject":"git push output goes into stderr","fromName":"Lynn Lin","fromEmail":"lynn.xin.lin@gmail.com","sentAt":"2011-09-04T09:26:59Z","receivedAt":"2011-09-04T09:26:59Z","isPatch":false,"sender":{"key":"lynn.xin.lin@gmail.com","avatar":null},"body":"Hi all,\nWhen I create a local branch and then push it to remote. I find that\nthe output without error goes into stderr, is this expected?\n\nLynn\n"},{"id":"174835","messageId":"7v8vq3ztym.fsf@alter.siamese.dyndns.org","threadId":"28296","inReplyTo":"CAPgpnMQuck_aPU0ciaGgj-C8rno7jbzZ7wZ4unU8CqA0eaiYQw@mail.gmail.com","subject":"Re: git push output goes into stderr","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-05T00:57:53Z","receivedAt":"2011-09-05T00:57:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lynn Lin <lynn.xin.lin@gmail.com> writes:\n\n> When I create a local branch and then push it to remote. I find that\n> the output without error goes into stderr, is this expected?\n\nProgress output are sent to the stderr stream.\n\nIn general, any program or script is buggy if it assumes that some output\nthat are emitted to the standard error output from programs it invokes\nindicates an error (IIRC, that includes tcl/tk).\n"},{"id":"174844","messageId":"CAMK1S_hDCot2TgmoQ-MXivKP6+1=QUi=Pno3-pOZ=FhooN9Duw@mail.gmail.com","threadId":"28296","inReplyTo":"CAPgpnMQuck_aPU0ciaGgj-C8rno7jbzZ7wZ4unU8CqA0eaiYQw@mail.gmail.com","subject":"Re: git push output goes into stderr","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2011-09-05T04:39:30Z","receivedAt":"2011-09-05T04:39:30Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Sun, Sep 4, 2011 at 2:56 PM, Lynn Lin <lynn.xin.lin@gmail.com> wrote:\n> Hi all,\n> When I create a local branch and then push it to remote. I find that\n> the output without error goes into stderr, is this expected?\n\nwhen the two sides of the conversation have an established protocol to\ntalk to each other and exchange data, any extraneous stuff (progress\nmessage, tracing/debugging logs...) will confuse the protocol.\nShunting that aside to STDERR helps avoid protocol confusion.\n"},{"id":"174903","messageId":"20110906074916.GC28490@ecki","threadId":"28296","inReplyTo":"7v8vq3ztym.fsf@alter.siamese.dyndns.org","subject":"Re: git push output goes into stderr","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2011-09-06T07:49:16Z","receivedAt":"2011-09-06T07:49:16Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:\n> Lynn Lin <lynn.xin.lin@gmail.com> writes:\n> \n> > When I create a local branch and then push it to remote. I find that\n> > the output without error goes into stderr, is this expected?\n> \n> Progress output are sent to the stderr stream.\n\nBut it's not only progress output that goes to stderr in case of\ngit push. Even the summary written in tranport_print_push_status\ngoes to stderr, unless we specify git push --porcelain. Can't we\nlet that part of the output go to stdout unconditionally?\n\nClemens\n"},{"id":"175046","messageId":"20110907215716.GJ13364@sigill.intra.peff.net","threadId":"28296","inReplyTo":"20110906074916.GC28490@ecki","subject":"Re: git push output goes into stderr","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-09-07T21:57:16Z","receivedAt":"2011-09-07T21:57:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 06, 2011 at 09:49:16AM +0200, Clemens Buchacher wrote:\n\n> On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:\n> > Lynn Lin <lynn.xin.lin@gmail.com> writes:\n> > \n> > > When I create a local branch and then push it to remote. I find that\n> > > the output without error goes into stderr, is this expected?\n> > \n> > Progress output are sent to the stderr stream.\n> \n> But it's not only progress output that goes to stderr in case of\n> git push. Even the summary written in tranport_print_push_status\n> goes to stderr, unless we specify git push --porcelain. Can't we\n> let that part of the output go to stdout unconditionally?\n\nWe could, though it makes more sense on stderr to me.\n\nStdout has always been about \"the main program output\" and stderr about\ndiagnostic messages. With a program whose main function is to generate\noutput (e.g., \"git tag -l\", it's very easy to know that the list of tags\nis the main program output (which you don't want to pollute with\nanything else), and any problems or even general chattiness goes to\nstderr.\n\nBut with a program whose main function is to perform an action, like\n\"git push\", I think there are really two ways to look at it:\n\n  1. There is no main output; any progress or status update is just\n     diagnostic chat, and should go to stderr.\n\n  2. The main output is the status report; it goes to stdout, and\n     progress updates go to stderr.\n\nI think both are equally valid mental models, and both are consistent\nwith the philosophy above. If we switch, I wouldn't be surprised to see\nsomebody say \"why is this going to stdout, it should be on stderr\". In\nfact, I seem to recall that we've had this discussion before on the\nlist.\n\n-Peff\n"},{"id":"175066","messageId":"CAMK1S_gro=THLkc_wrHSLwUVaJp9k-zRDuFDQpOGaiyBTHiDnQ@mail.gmail.com","threadId":"28296","inReplyTo":"20110907215716.GJ13364@sigill.intra.peff.net","subject":"Re: git push output goes into stderr","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2011-09-08T05:42:48Z","receivedAt":"2011-09-08T05:42:48Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Thu, Sep 8, 2011 at 3:27 AM, Jeff King <peff@peff.net> wrote:\n> On Tue, Sep 06, 2011 at 09:49:16AM +0200, Clemens Buchacher wrote:\n>\n>> On Sun, Sep 04, 2011 at 05:57:53PM -0700, Junio C Hamano wrote:\n>> > Lynn Lin <lynn.xin.lin@gmail.com> writes:\n>> >\n>> > > When I create a local branch and then push it to remote. I find that\n>> > > the output without error goes into stderr, is this expected?\n>> >\n>> > Progress output are sent to the stderr stream.\n>>\n>> But it's not only progress output that goes to stderr in case of\n>> git push. Even the summary written in tranport_print_push_status\n>> goes to stderr, unless we specify git push --porcelain. Can't we\n>> let that part of the output go to stdout unconditionally?\n>\n> We could, though it makes more sense on stderr to me.\n>\n> Stdout has always been about \"the main program output\" and stderr about\n> diagnostic messages. With a program whose main function is to generate\n> output (e.g., \"git tag -l\", it's very easy to know that the list of tags\n> is the main program output (which you don't want to pollute with\n> anything else), and any problems or even general chattiness goes to\n> stderr.\n>\n> But with a program whose main function is to perform an action, like\n> \"git push\", I think there are really two ways to look at it:\n>\n>  1. There is no main output; any progress or status update is just\n>     diagnostic chat, and should go to stderr.\n>\n>  2. The main output is the status report; it goes to stdout, and\n>     progress updates go to stderr.\n\nI always thought if you write stuff to stdout the remote client gets\nconfused because it is executing to a defined protocol and suddenly\nsees unexpected input in the middle.\n\nBit if *you* are saying this (output random stuff to STDOUT) can\nhappen if we want it to, clearly I was wrong...\n\n> I think both are equally valid mental models, and both are consistent\n> with the philosophy above. If we switch, I wouldn't be surprised to see\n> somebody say \"why is this going to stdout, it should be on stderr\". In\n> fact, I seem to recall that we've had this discussion before on the\n> list.\n"},{"id":"175069","messageId":"20110908070706.GA1454@sigill.intra.peff.net","threadId":"28296","inReplyTo":"CAMK1S_gro=THLkc_wrHSLwUVaJp9k-zRDuFDQpOGaiyBTHiDnQ@mail.gmail.com","subject":"Re: git push output goes into stderr","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-09-08T07:07:06Z","receivedAt":"2011-09-08T07:07:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 08, 2011 at 11:12:48AM +0530, Sitaram Chamarty wrote:\n\n> > But with a program whose main function is to perform an action, like\n> > \"git push\", I think there are really two ways to look at it:\n> >\n> >  1. There is no main output; any progress or status update is just\n> >     diagnostic chat, and should go to stderr.\n> >\n> >  2. The main output is the status report; it goes to stdout, and\n> >     progress updates go to stderr.\n> \n> I always thought if you write stuff to stdout the remote client gets\n> confused because it is executing to a defined protocol and suddenly\n> sees unexpected input in the middle.\n> \n> Bit if *you* are saying this (output random stuff to STDOUT) can\n> happen if we want it to, clearly I was wrong...\n\nFor the remote side, yes, we have to be sure not to pollute stdout,\nbecause that's where the protocol is going.. But the status table is\ngenerated on the client side, so stdout is just connected to the user's\nterminal there.\n\nWe already generate --porcelain status output from push on stdout (and\nagain, that makes sense to me philosophically, because the user is\nasking push to generate the output). So it's clearly not a big deal.\nIt's just a matter of taste.\n\n-Peff\n"},{"id":"175074","messageId":"CAMK1S_g5FjqBV=a19LPdwLCHbcvoG+5cQe9ZcLSz-hxEi3KkCg@mail.gmail.com","threadId":"28296","inReplyTo":"20110908070706.GA1454@sigill.intra.peff.net","subject":"Re: git push output goes into stderr","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2011-09-08T08:24:00Z","receivedAt":"2011-09-08T08:24:00Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Thu, Sep 8, 2011 at 12:37 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, Sep 08, 2011 at 11:12:48AM +0530, Sitaram Chamarty wrote:\n>\n>> > But with a program whose main function is to perform an action, like\n>> > \"git push\", I think there are really two ways to look at it:\n>> >\n>> >  1. There is no main output; any progress or status update is just\n>> >     diagnostic chat, and should go to stderr.\n>> >\n>> >  2. The main output is the status report; it goes to stdout, and\n>> >     progress updates go to stderr.\n>>\n>> I always thought if you write stuff to stdout the remote client gets\n>> confused because it is executing to a defined protocol and suddenly\n>> sees unexpected input in the middle.\n>>\n>> Bit if *you* are saying this (output random stuff to STDOUT) can\n>> happen if we want it to, clearly I was wrong...\n>\n> For the remote side, yes, we have to be sure not to pollute stdout,\n> because that's where the protocol is going.. But the status table is\n> generated on the client side, so stdout is just connected to the user's\n> terminal there.\n\n aah ok, that makes sense; thanks.\n"}]}