Re: [RFC PATCH 1/2] sh-setup: Make die take the error code as param.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 15, 2011, 20:46 UTC
- Message-ID
- <7vzkmnofo0.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1f45f5634f08cb0f63d61d8b734a2cf7bebf591b.1305462132.git.iveqy@iveqy.com>
Fredrik Gustafsson <iveqy@iveqy.com> writes:
Show 8 quoted lines
> die used to print all parameters and then exit with code 1. Now die > prints the first parameter and uses the optional second parameter as the > exit code. The default exit code is 1. > > This allows scripts to control the exit code when they call die. > > All current git-code only uses the first parameter of die today so this > change has no impact on them.
There are two issues in that logic.
The git-sh-setup API is a published interface that third-party Porcelains can use, so it is insufficient to audit only the in-tree code.
Besides, your audit of in-tree code is insufficient. See output from this:
$ git grep -A1 -n -e 'die .*\\$' -- '*.sh'
The hits in git-bisect.sh and git-rebase--merge.sh both pass two strings.
Can't you instead introduce a new "die_with_status" function and use it?