Re: [PATCHv2] am: fix patch format detection for Thunderbird "Save As" emails
On Fri, 2009-12-18 at 21:42 +0000, Eric Blake wrote:
Show 12 quoted lines
> Stephen Boyd <bebarino <at> gmail.com> writes:
>
> > + {
> > + echo "X-Fake-Field: Line One\015" &&
>
> echo and \ do not portably mix. For that matter, shell double quotes and
> backslash escapes that are not required by POSIX do not portably mix. To
> reliably create carriage returns in shell, you need to use printf, or else
> something like:
>
> echo "...@" | tr '@' '\015'
> Thanks. Hopefully squashing this in will make it even more portable?
--->8---
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 7b6269d..19d5ca1 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -84,18 +84,18 @@ test_expect_success setup '
git format-patch --stdout first | sed -e "1d"
} > patch1.eml &&
{
- echo "X-Fake-Field: Line One\015" &&
- echo "X-Fake-Field: Line Two\015" &&
- echo "X-Fake-Field: Line Three\015" &&
+ printf "X-Fake-Field: Line One\015\n" &&
+ printf "X-Fake-Field: Line Two\015\n" &&
+ printf "X-Fake-Field: Line Three\015\n" &&
git format-patch --stdout first |
sed -e "1d" -e "3,\$d" | tr -d "\n" &&
- echo "\015" &&
+ printf "\015\n" &&
git format-patch --stdout first |
sed -e "1,2d" -e "4,\$d" | tr -d "\n" &&
- echo "\015" &&
+ printf "\015\n" &&
git format-patch --stdout first |
sed -e "1,3d" -e "5,\$d" | tr -d "\n" &&
- echo "\015\n\015" &&
+ printf "\015\n\015\n" &&
git format-patch --stdout first | sed -e "1,5d"
} > patch1-crlf.eml &&
sed -n -e "3,\$p" msg >file &&