Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] git-send-email: show all headers when sending mail

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:50

Possibly related (same subject, not in this thread)

"David D. Kilzer" [off-list ref] writes:
+replace_header () {
+	EXPECTED=expected-show-all-headers &&
+	ACTUAL=actual-show-all-headers &&
+	REPLACEMENT=`cat ${ACTUAL} | grep "^$1:"` &&
+	if [ ! -z "${REPLACEMENT}" ]; then \
+		cat ${EXPECTED} | sed -e "s/^$1: .*\$/${REPLACEMENT}/" > ${EXPECTED}.$$ && \
+		mv -f ${EXPECTED}.$$ ${EXPECTED}
+	fi
+}
If the actual output did not have an asked-for field,
REPLACEMENT will be empty and the breakage will go unnoticed,
won't it?

It would probably be better to write it this way:

	test_expect_success 'Show all headers' '

		git send-email \
                	--dry-run \
                        --from="Example [off-list ref]" \
                        --to=to@example.com \
                        --cc=cc@example.com \
                        --bcc=bcc@example.com \
                        --in-reply-to="[off-list ref]" \
                        --smtp-sever relay.example.com \
                        $patches |
		sed	-e "s/^\(Date:\).*/1 DATE-STRING/" \
                	-e "s/^\(Message-Id:\).*/1 ID-STRING/" \
                        -e "s/^\(X-Mailer:\).*/1 X-MAILER-STRING/" \
			>actual &&
		diff -u expected actual

        '

and prepare the expected output with the varying field already
replaced with the placeholder string.

Oh, by the way, do not cat a single file and pipe it to another
command.  There may still be a few such stupidity in our test
scripts but let's not add even more of them...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help