From: Fredrik Gustafsson Date: Thu, 09 Jun 2011 07:47:02 GMT Subject: [PATCH v3 1/2] Add new function die_with_status Message-ID: <1307605623-2831-2-git-send-email-iveqy@iveqy.com> In-Reply-To: <1307605623-2831-1-git-send-email-iveqy@iveqy.com> This function takes the exit code as a parameter. This allows scripts to control the exit code when they need to die. Make the old die-function to use die_with_status for simpler maintenance. die no longer prints empty die messages, this is a changed behavior. Signed-off-by: Fredrik Gustafsson Mentored-by: Jens Lehmann Mentored-by: Heiko Voigt --- git-sh-setup.sh | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 94e26ed..1a91f6e 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -40,8 +40,16 @@ git_broken_path_fix () { # @@BROKEN_PATH_FIX@@ die() { - echo >&2 "$@" - exit 1 + die_with_status 1 $@ +} +die_with_status() { + stat=$1 + shift + if test ${#@} -gt 0 + then + echo >&2 "$@" + fi + exit $stat } GIT_QUIET= -- 1.7.6.rc0.14.g4fc55