Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Allow git-diff exit with codes similar to diff(1)

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:59

Junio C Hamano [off-list ref] writes:
I've been telling you since the #git session that I know that is
*different* from how "diff" works, and I think everybody agrees
if we were doing git from scratch today we would have done exit
status with 0/1/other to signal no-change, have-diff and error.

But the established way for scripts that use plumbing is

 - to check error with $? (or ... || )
 - to check modified-or-not with output

and people who have been learning from the scripts (we used to
have lot more scripts) would have picked up that pattern.
That's why I already told you that --exit-status is the right
thing to do if we were doing it from scratch, but is a wrong
thing to do at this point.
Correction.

s/--exit-status is/doing --exit-status without such an explicit option is/.
Maybe in a release as big as 1.5.0
that we pre-announce a lot of interface changes.

In short, Linus is right in that the current exit code is not
useful to see what the end users are interested in (and they are
not in the business of debugging git, and diff would error out
only when the repository has problems, perhaps a corrupt object
or something like that).  But being not useful and being
currently not relied upon are two different things.

And I am being conservative, especially after a big release.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help