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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"David D. Kilzer" <ddkilzer@xxxxxxxxxx> 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 <from@xxxxxxxxxxx>" \
                        --to=to@xxxxxxxxxxx \
                        --cc=cc@xxxxxxxxxxx \
                        --bcc=bcc@xxxxxxxxxxx \
                        --in-reply-to="<unique-message-id@xxxxxxxxxxx>" \
                        --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...

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux