1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!/bin/bash
source "$TESTS_DIR/functions.sh"
msgfile="$TEST_DIR/message"
cat >"$msgfile" <<EOF
123456789 123456789 123456789 123456789 123456789 123456789
This is the description.
EOF
# Copy out the cover letter before git-send-email(1) is invoked
hookfile=".git/hooks/pre-publish-send-email"
coverfile="$TEST_DIR/0000-cover-letter-patch"
cat >"$hookfile" <<EOF
#!/bin/bash
cp "\$1/0000-cover-letter.patch" "$coverfile"
exit 0
EOF
chmod 755 "$hookfile"
git checkout -q -b mybranch
GIT_EDITOR="cp $msgfile" git-publish --no-inspect-emails \
--to somebody@example.com \
-b HEAD^ \
--cover-letter \
--subject-prefix="PATCH" || :
echo -ne \
'Subject: [PATCH 0/1] 123456789 123456789 123456789 123456789 123456789 123456789\n' \
>"$TEST_DIR/expected"
grep '^Subject:' "$coverfile" >"$TEST_DIR/found"
assert diff -u "$TEST_DIR/expected" "$TEST_DIR/found"
|