Code

git-sh-setup: add die_with_status
authorFredrik Gustafsson <iveqy@iveqy.com>
Thu, 9 Jun 2011 07:47:02 +0000 (09:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Jun 2011 18:23:28 +0000 (11:23 -0700)
This behaves similar to "die" but can exit with status different from the
usual 1.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-sh-setup.sh

index 94e26ed5e8dcf84c4f238c76b6c508dc84d0b7ea..8e427dab31c27bd78d9eac1ad15bc1f5dcc044c4 100644 (file)
@@ -39,9 +39,15 @@ git_broken_path_fix () {
 
 # @@BROKEN_PATH_FIX@@
 
-die() {
-       echo >&2 "$@"
-       exit 1
+die () {
+       die_with_status 1 "$@"
+}
+
+die_with_status () {
+       status=$1
+       shift
+       echo >&2 "$*"
+       exit "$status"
 }
 
 GIT_QUIET=