From: Fredrik Gustafsson <iveqy@iveqy.com>
To: git@vger.kernel.org
Cc: jens.lehmann@web.de, hvoigt@hvoigt.net, gitster@pobox.com
Subject: [RFC PATCH 1/2] sh-setup: Make die take the error code as param.
Date: Sun, 15 May 2011 14:42:20 +0200 [thread overview]
Message-ID: <1f45f5634f08cb0f63d61d8b734a2cf7bebf591b.1305462132.git.iveqy@iveqy.com> (raw)
In-Reply-To: <cover.1305462132.git.iveqy@iveqy.com>
In-Reply-To: <cover.1305462132.git.iveqy@iveqy.com>
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 <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
---
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
next prev parent reply other threads:[~2011-05-15 12:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-15 12:42 [RFC PATCH 0/2] submodule update continue Fredrik Gustafsson
2011-05-15 12:42 ` Fredrik Gustafsson [this message]
2011-05-15 20:46 ` [RFC PATCH 1/2] sh-setup: Make die take the error code as param Junio C Hamano
2011-05-15 12:42 ` [RFC PATCH 2/2] submodule update: continue when a checkout fails Fredrik Gustafsson
2011-05-15 21:26 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f45f5634f08cb0f63d61d8b734a2cf7bebf591b.1305462132.git.iveqy@iveqy.com \
--to=iveqy@iveqy.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=jens.lehmann@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).