Re: [PATCH] Allow git-diff exit with codes similar to diff(1)
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Mar 14, 2007, 01:13 UTC
- Message-ID
- <Pine.LNX.4.64.0703131757080.9690@woody.linux-foundation.org>
- In-Reply-To
- <81b0412b0703131717k7106ee1cg964628f0bda2c83e@mail.gmail.com>
On Wed, 14 Mar 2007, Alex Riesen wrote:
> > This introduces a new command-line option: --exit-code. The diff > programs will return 1 for differences, return 0 for equality, and > something else for errors.
I don't think you should need a new command-line option.
Is there any reason to not just do this unconditionally?
> As promised on irc. I'm somewhat confused about diff_tree: it used to > unconditionally return 0, yet every caller of it saves and passes the > value!
I think we just never implemented the error codes, but they were always meant to be there.
I also thought I did some early-out logic (for the revision list pruning thing), where the "show_entry()" routine could return a negative value to say "Ok, no need to do anything more" but apparently I never added that..
[ I have this very distinct memory of working on it, but either I was dreaming or I never got it working.. ]
Linus