Re: [PATCH v6] format-patch --signature-file <file>

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

 



Jeremiah Mahler <jmmahler@xxxxxxxxx> writes:

> 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@xxxxxxxxxx>
> +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 actual

Alternatively, 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 actual

Thanks.
--
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]