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 <redacted>
Mentored-by: Jens Lehmann [off-list ref]
Mentored-by: Heiko Voigt [off-list ref]
---
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