From: Junio C Hamano <gitster@pobox.com>
To: Luben Tuikov <luben.tuikov@amd.com>
Cc: "Strawbridge, Michael" <Michael.Strawbridge@amd.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH v6 2/2] send-email: expose header information to git-send-email's sendemail-validate hook
Date: Mon, 16 Jan 2023 23:31:34 -0800 [thread overview]
Message-ID: <xmqqbkmxbort.fsf@gitster.g> (raw)
In-Reply-To: <3a2d4559-fce2-80f3-bafd-5eb8ac1a7eff@amd.com> (Luben Tuikov's message of "Tue, 17 Jan 2023 00:06:35 -0500")
Luben Tuikov <luben.tuikov@amd.com> writes:
>> +test_expect_success $PREREQ "--validate hook supports header argument" '
>> + write_script my-hooks/sendemail-validate <<-\EOF &&
>> + if test -s "$2"
>> + then
>> + cat "$2" >actual
>> + exit 1
>> + fi
>> + EOF
If "$2" is not given, or an empty "$2" is given, is that an error?
I am wondering if the lack of "else" clause (and the hook exits with
success when "$2" is an empty file) here is intentional.
>> + cat actual | replace_variable_fields \
>> + >actual-headers &&
Do not cat a single file into a pipe. You can instead redirect out
of the file to whatever is reading from the pipe. I.e.
replace_variable_fields <actual >actual-headers &&
>> + test_cmp expected-headers actual-headers
>> +'
OK. We make sure the presence and the order of the fields in the
output just like all the other tests in this file do (which I think
may be a bit too much---there is no strong reason to insist that
"Subject:" comes before or after "Date:" or is spelled "Subject:"
and not "subject:" or "SUBJECT:"---but that is a problem shared with
many other existing tests in this file and this patch is not making
it much worse).
>> for enc in 7bit 8bit quoted-printable base64
>> do
>> test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
>
> As Junio and I discussed in the v5 2/2 patch review, here we may want to
> do something like this: Add a custom header to the SMTP envelope and then make
> sure that that is present when the hook checks $2.
Adding a custom header test is also fine, but I am OK with what we
see above, to verify the headers just the same way as existing
tests.
next prev parent reply other threads:[~2023-01-17 7:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 1:39 [PATCH v6 0/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-17 1:39 ` [PATCH v6 1/2] send-email: refactor header generation functions Strawbridge, Michael
2023-01-17 3:38 ` Luben Tuikov
2023-01-17 4:13 ` Luben Tuikov
2023-01-17 1:39 ` [PATCH v6 2/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-17 4:35 ` Luben Tuikov
2023-01-17 5:06 ` Luben Tuikov
2023-01-17 7:31 ` Junio C Hamano [this message]
2023-01-18 8:31 ` Luben Tuikov
2023-01-18 16:27 ` Junio C Hamano
2023-01-18 16:35 ` Luben Tuikov
2023-01-18 20:44 ` Michael Strawbridge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqbkmxbort.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Michael.Strawbridge@amd.com \
--cc=git@vger.kernel.org \
--cc=luben.tuikov@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.