From: Petr Baudis Date: Thu, 25 Sep 2008 16:55:28 +0000 (+0200) Subject: tg mail: Fix $header string construction X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=b12909b329bc716317f37465c6f8652394c857c4 tg mail: Fix $header string construction Prevents e.g. misinterpreting From: line at the body start. --- diff --git a/tg-mail.sh b/tg-mail.sh index 24e5f67..fb686e9 100644 --- a/tg-mail.sh +++ b/tg-mail.sh @@ -29,10 +29,9 @@ base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" patchfile="$(mktemp -t tg-mail.XXXXXX)" -$tg patch $name >"$patchfile" +$tg patch "$name" >"$patchfile" -hlines=$(grep -n -m 1 '^---' "$patchfile" | sed 's/:---//') -header=$(head -n $(($hlines - 1)) "$patchfile") +header="$(sed -e '/^$/,$d' "$patchfile")"