From: Fredrik Gustafsson Date: Sun, 15 May 2011 12:42:20 GMT Subject: [RFC PATCH 1/2] sh-setup: Make die take the error code as param. Message-ID: <1f45f5634f08cb0f63d61d8b734a2cf7bebf591b.1305462132.git.iveqy@iveqy.com> In-Reply-To: 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. Signed-off-by: Fredrik Gustafsson Mentored-by: Jens Lehmann Mentored-by: Heiko Voigt --- git-sh-setup.sh | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index aa16b83..6aa6c59 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -40,7 +40,11 @@ git_broken_path_fix () { # @@BROKEN_PATH_FIX@@ die() { - echo >&2 "$@" + echo >&2 "$1" + if test $2 + then + exit $2 + fi exit 1 } -- 1.7.5.1.219.ge2152.dirty