git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/3] git-push: clean up some of the output from git push --porcelain

From
Jeff King <peff@peff.net>
Date
Feb 10, 2010, 05:39 UTC
Message-ID
<20100210053937.GF28526@coredump.intra.peff.net>
In-Reply-To
<7viqa7cqs9.fsf@alter.siamese.dyndns.org>
On Mon, Feb 08, 2010 at 02:21:26PM -0800, Junio C Hamano wrote:
> I think the purpose of the patches that started this thread was to admit
> that 1965ff7 (add --porcelain option to git-push, 2009-06-22) was not well
> thought out, and to break compatibility to fix it.

I thought it was simply to remove stdout cruft that had crept in, and at the same time to remove some stderr cruft that was simply noise on the terminal. That being said, I am in favor of fixing it even if it means a slight compatibility breakage.

Show 9 quoted lines
> Having said that, I would say that what 1965ff7 specified was only these
> two:
> 
>     = TAB refs/heads/master:refs/heads/master TAB [up to date]
>     - TAB :refs/heads/foobar TAB [deleted]
> 
> so everything else that do not match this pattern is a fair game, most
> importantly, the line that begins with "To" would not be mistaken with
> this pattern, I think.
It depends on the parser. If the parser was something like:
  switch (line[0]) {
    case '=': ...; break;
    case '-': ...; break;
    default: die("wtf: %s", line);
  }

then we are not introducing any ambiguity, but we are causing a breakage. The problem is that we did not specify the format anywhere, so it is hard to say whether we are breaking any promises we made.

Show 10 quoted lines
> > This one, on the other hand, seems to me to be just noise. What does a
> > --porcelain caller learn by seeing "Everything up-to-date" that it did
> > not already know from seeing the list of refs?
> 
> I do not care too much about this hunk either way.  We could leave it as
> is, as we will be giving some other stuff to the standard error stream
> without squelching anyway, even with the three-patch series.  We could
> squelch only this message, but it is dubious what it is buying us.  If you
> forced me to decide, I would probably say "let's just drop this hunk and
> keep the code as-is".

I have not actually been running these patches, just reading them, but my impression was the goal _was_ to squelch all of the stderr cruft. But if we are not even close, then probably we should just give up and callers should "2>/dev/null".

Show 8 quoted lines
> As to the exit status, do you have any thoughts, by the way?
> 
> I am not convinced that it would be necessary nor even a good idea to make
> it behave inconsistently between the normal case and Porcelain case, only
> to make it easier to special case the "remote side would reject due to
> non-fast-forward" failure mode (iow, even if the calling script knows that
> it would fail due to non-fast-forward but otherwise everything else would
> be fine, what good would it do?)

I had initially endorsed it, but now I am having second thoughts. Especially if the "usual" calling convention is to redirect stderr as above, then we are probably missing out on any useful error messages that accompany a failure return, anyway. So maybe the sane thing to do is to leave the exit code alone, and include a --porcelain output line that either says "Everything was OK, see individual ref status" or "We couldn't even talk to the other side". Then the status code is irrelevant, and stdout contains all of the useful information (and if you don't get an error or OK message, you know there was some serious error like a broken git installation).

-Peff
Previous: Larry D'AnnaNext: Larry D'Anna
Message 30 of 45 in “git-push: fix an error message so it goes to stderr”
  1. 1/3 git-push: fix an error message so it goes to stderrLarry D'Anna, Feb 8, 2010
  2. 2/3 git-push: clean up some of the output from git push --porcelainLarry D'Anna, Feb 8, 2010
  3. Junio C HamanoFeb 8, 2010
  4. Junio C HamanoFeb 8, 2010
  5. Jeff KingFeb 8, 2010
  6. Larry D'AnnaFeb 8, 2010
  7. Junio C HamanoFeb 8, 2010
  8. Larry D'AnnaFeb 8, 2010
  9. git-push: clean up some of the output from git pushLarry D'Anna, Feb 8, 2010
  10. Junio C HamanoFeb 8, 2010
  11. Larry D'AnnaFeb 8, 2010
  12. Junio C HamanoFeb 8, 2010
  13. git-push: fix the documentation to explain all the status flagsLarry D'Anna, Feb 8, 2010
  14. Junio C HamanoFeb 9, 2010
  15. Junio C HamanoFeb 9, 2010
  16. Junio C HamanoFeb 9, 2010
  17. Larry D'AnnaFeb 9, 2010
  18. Junio C HamanoFeb 9, 2010
  19. Larry D'AnnaFeb 9, 2010
  20. Larry D'AnnaFeb 9, 2010
  21. Junio C HamanoFeb 9, 2010
  22. Larry D'AnnaFeb 9, 2010
  23. Shawn O. PearceFeb 9, 2010
  24. Nicolas PitreFeb 9, 2010
  25. Shawn O. PearceFeb 9, 2010
  26. Junio C HamanoFeb 9, 2010
  27. Junio C HamanoFeb 9, 2010
  28. Shawn O. PearceFeb 10, 2010
  29. Larry D'AnnaFeb 9, 2010
  30. Jeff KingFeb 10, 2010
  31. Larry D'AnnaFeb 10, 2010
  32. Tay Ray ChuanFeb 10, 2010
  33. Junio C HamanoFeb 8, 2010
  34. Jeff KingFeb 10, 2010
  35. Junio C HamanoFeb 11, 2010
  36. Jeff KingFeb 12, 2010
  37. 3/3 git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejectedLarry D'Anna, Feb 8, 2010
  38. Junio C HamanoFeb 8, 2010
  39. Larry D'AnnaFeb 8, 2010
  40. Junio C HamanoFeb 9, 2010
  41. Larry D'AnnaFeb 10, 2010
  42. 4/4 git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejectedLarry D'Anna, Feb 10, 2010
  43. Larry D'AnnaFeb 15, 2010
  44. Junio C HamanoFeb 15, 2010
  45. Junio C HamanoFeb 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.