Re: [PATCH v3 1/2] Add new function die_with_status
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:28
Fredrik Gustafsson [off-list ref] writes:
die no longer prints empty die messages, this is a changed behavior.
That is what we we usually call a regression, but I think the original is not correct to begin with. It should have used "$*" not "$@".
quoted hunk
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 $@
Make it a habit to always quote "$@" when relaying what was given to you,
so that when somebody sends a parameter with IFS in it, you won't split it
while passing it down. I.e.
die () {
die_with_status 1 "$@"
}
+}
Blank line here after the closing brace and the beginning of next function.
+die_with_status() {
+ stat=$1
+ shift
+ if test ${#@} -gt 0
+ then
+ echo >&2 "$@"
+ fiI think an unconditional echo >&2 "$*" is good enough here.
+ exit $stat } GIT_QUIET=