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

Re: [PATCH v3 3/3] git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejected

From
Larry D'Anna <larry@elder-gods.org>
Date
Feb 8, 2010, 21:49 UTC
Message-ID
<20100208214939.GA11355@cthulhu>
In-Reply-To
<7vpr4figv3.fsf@alter.siamese.dyndns.org>
* Junio C Hamano (gitster@pobox.com) [100208 15:59]:
Show 11 quoted lines
> Larry D'Anna <larry@elder-gods.org> writes:
> 
> > The script calling git push --dry-run --porcelain can see clearly from the
> > output that the updates will be rejected.  However, it will probably need to
> > distinguish this condition from the push failing for other reasons, such as the
> > remote not being reachable.
> 
> I am not sure about this reasoning.  If you are telling the script writers
> to decide what happened by reading from the output, shouldn't the program
> say "I fail because I cannot reach the other side" to its standard output
> so that the script can read it as well?

Wouldn't that just complicate life for the script writer? If you send such messages to the standard output, the script would have to include logic to distinguish error messages from the rest of the output. If you send them to the standard error then the script knows exactly where to find them.

Show 7 quoted lines
> Having said that, I don't think it matters either way.  If a script wants
> to know if push would fully succeed or not, it will run without
> --porcelain (perhaps while discarding the standard error) and check the
> status.  Even without this patch, if a script runs with --porcelain and
> gets non-zero status, it can inspect the output and if it got rejection,
> that is a sure sign that it at least reached the other end to get enough
> information to decide that it will be rejected, no?

Yes, it's a sure sign that it reached the other side, but how does the script know nothing else went wrong? What if a malloc failed? OK that's a bit far fetched, but it's really, really nice to be able to get an unambiguous status bit out of a command so you know if the requested operation succeeded or not. Without this patch, a script calling git push --porcelain --dry-run has no way of distinguishing these two situations

1) "git push" would try to push a ref that would get rejected, but everything
else is fine.
2) "git push" would try to push a ref that would get rejected, and also some
unknown type of error occurred that this script has no idea how to handle.
        --larry
            
Previous: Junio C HamanoNext: Junio C Hamano
Message 39 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.