Re: [PATCH v6] format-patch --signature-file <file>
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 21, 2014, 21:13 UTC
- Message-ID
- <xmqq61kyq1i5.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1400634170-18266-2-git-send-email-jmmahler@gmail.com>
Jeremiah Mahler <jmmahler@gmail.com> writes:
Show 16 quoted lines
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh > index 9c80633..049493d 100755 > --- a/t/t4014-format-patch.sh > +++ b/t/t4014-format-patch.sh > @@ -762,6 +762,38 @@ test_expect_success 'format-patch --signature="" suppresses signatures' ' > ! grep "^-- \$" output > ' > > +cat >expect <<-\EOF > + > +Test User <test.email@kernel.org> > +http://git.kernel.org/cgit/git/git.git > + > +git.kernel.org/?p=git/git.git;a=summary > + > +EOF
We have been trying not to do the above in recent test updates. It would be nice if this set-up did not have to be outside of the usual test_expect_success structure.
> +test_expect_success 'format-patch --signature-file=file' ' > + git format-patch --stdout --signature-file=expect -1 >output && > + check_patch output && > + sed -n -e "/^-- $/,\$p" <output | sed -e "1 d" | sed -e "\$d" | sed -e "\$d" >output2 &&
Overlong line. If we can't make this pipeline shorter, at least fold it to a reasonable length, e.g.
sed -n -e ... <output |
sed -e '1d' -e "\$d" |
sed -e "\$d" >output2 &&or something.
The SP between the address "1" and insn "d" looks somewhat funny and ugly, especially given that you write the other one "$d" without such a SP. Was there a specific reason why it was needed?
I would further think that renaming a few files and updating the way the check is done may make the whole thing easier to understand.
* rename the input for --signature-file to "mail-signature".
* keep the name "output" to hold the format-patch output, i.e.
git format-patch -1 --stdout --signature-file=mail-signature >output
* Instead of munging the "mail signature" part of the output too excessively to match the input, formulate the expected output using "mail-signature" as an input, i.e.
sed -e '1,/^-- $/d' <output >actual &&
{
cat mail-signature && echo && echo
} >expect &&
test_cmp expect actualAlternatively, the third-bullet point above may want to be further future-proofed by using stripspace, e.g.
sed -e '1/^-- $/d' <output | git stripspace >actual &&
git stripspace <mail-signature >expect &&
test_cmp expect actualThanks.