git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: nadim khemir <nadim@khemir.net>
To: "git list" <git@vger.kernel.org>
Subject: Adding Exit status documentation to all git commands starting with git status
Date: Sat, 13 Dec 2008 20:36:39 +0100	[thread overview]
Message-ID: <200812132036.39318.nadim@khemir.net> (raw)

I was asking on the irc channel about how to know if I need to commit. I 
promptely got answered but during the discussion, the few of us still awake 
in the middle of the night (for me at least), agreed that it would be good to 
have a EXIT STATUS in all the commands documentation starting with 
the 'status' command.

The current documentation of 'git status' does cover exit status and looks 
like:
<original>
...
shows what would be committed if the same options are given to
'git-commit'.

If there is no path that is different between the index file and
the current HEAD commit (i.e., there is nothing to commit by running
`git commit`), the command exits with non-zero status.


OUTPUT
------
</original>

There are different styles to add exit status, give me your input on why and 
why not using one or the other. I list 3 solutions and what I think about 
them.

<solution 1, least change, easier to recognize although all the negations and 
the explaination being about when the command ~fails~ makes newbies head spin 
for a few seconds>

...
shows what would be committed if the same options are given to
'git-commit'.

EXIT STATUS
-----------
The command exits with non-zero status if there is no path that is 
different between the index file and the current HEAD commit (i.e.,
there is nothing to commit by running `git commit`).


OUTPUT
------
</solution 1>



<solution 2, both zero and non zero status>

...
shows what would be committed if the same options are given to
'git-commit'.

EXIT STATUS
-----------
Zero status:      There is a different between the index file and HEAD.
Non-zero status:  There is nothing to commit by running `git commit`. 


OUTPUT
------
</solution 2>



<solution 3, Only zero status, non zero is easilly deducted. Clearest IMO>

...
shows what would be committed if the same options are given to
'git-commit'.

EXIT STATUS
-----------
Zero status: There is a different between the index and HEAD; running 
`git commit` would create a new commit. 


OUTPUT
------
</solution 3>



A few things could be better explained:
	- The command is to be run with '-a' as option. 
	- The fact that non add'ed files are not taken into account is not
completely obvious. The first paragraph of the DESCRIPTION explains it but it  
is not the clearest explaination ever (maybe because it's not easy to explain 
and man pages are references not user manuals)

Cheers, Nadim.

             reply	other threads:[~2008-12-13 19:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 19:36 nadim khemir [this message]
2008-12-13 20:04 ` Adding Exit status documentation to all git commands starting with git status Junio C Hamano

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=200812132036.39318.nadim@khemir.net \
    --to=nadim@khemir.net \
    --cc=git@vger.kernel.org \
    /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).