chiark / gitweb /
tg-mail: do not use arrays, which are bashisms
authormartin f. krafft <madduck@madduck.net>
Fri, 26 Sep 2008 19:04:19 +0000 (21:04 +0200)
committerPetr Baudis <pasky@suse.cz>
Fri, 7 Nov 2008 21:24:03 +0000 (22:24 +0100)
tg-mail uses shell arrays for the people array, which are not supported by
POSIX. The script runs as /bin/sh, so it cannot assume non-POSIX features.
This patch reimplements the array population with a POSIX-compliant approach.

Signed-off-by: martin f. krafft <madduck@madduck.net>
tg-mail.sh

index dd50004a96127f9b6a26a93d1c47503c8aa1882d..7b8f7ffdd61b9b9b802df04790be5d51ffa67c2a 100644 (file)
@@ -46,14 +46,12 @@ from="$(echo "$header" | grep '^From:' | sed 's/From:\s*//')"
 to="$(echo "$header" | grep '^To:' | sed 's/To:\s*//')"
 
 
-# XXX: I can't get quoting right without arrays
-people=()
-[ -n "$from" ] && people=("${people[@]}" --from "$from")
+people=
+[ -n "$from" ] && people="$people --from '$from'"
 # FIXME: there could be multimple To
-[ -n "$to" ]   && people=("${people[@]}" --to "$to")
-
+[ -n "$to" ] && people="$people --to '$to'"
 
 # NOTE: git-send-email handles cc itself
-git send-email $send_email_args "${people[@]}" "$patchfile"
+eval git send-email $send_email_args "$people" "$patchfile"
 
 rm "$patchfile"