git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding Exit status documentation to all git commands starting with git status
@ 2008-12-13 19:36 nadim khemir
  2008-12-13 20:04 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: nadim khemir @ 2008-12-13 19:36 UTC (permalink / raw)
  To: git list

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.

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

* Re: Adding Exit status documentation to all git commands starting with git status
  2008-12-13 19:36 Adding Exit status documentation to all git commands starting with git status nadim khemir
@ 2008-12-13 20:04 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2008-12-13 20:04 UTC (permalink / raw)
  To: nadim khemir; +Cc: git list

nadim khemir <nadim@khemir.net> writes:

> 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.

No matter what you do, I think EXIT STATUS section should consistently
come near the end of the document, immediately before SEE ALSO, which is
where people who know how manual pages are written expect to find it.

> 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`).

Prose is much easier to read as long as it is brief enough, than two-item
enumeration:

> 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`. 

whose use of "Zero status" makes it look doubly funny (traditionally
manual pages do not seem to spell out exit status 0 as "zero", but
"non-zero" is Ok).

Avoid talking about only one side of the condition if you can without
being too verbose.

        The command exits with status 0 if there is something to commit by
        running `git commit` with corresponding arguments, and non-zero
        otherwise.

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

end of thread, other threads:[~2008-12-13 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 19:36 Adding Exit status documentation to all git commands starting with git status nadim khemir
2008-12-13 20:04 ` Junio C Hamano

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).