git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 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.
Previous: Jeremiah MahlerNext: Junio C Hamano
Message 3 of 14 in “format-patch --signature-file <file>”
  1. format-patch --signature-file <file>Jeremiah Mahler, May 21, 2014
  2. format-patch --signature-file <file>Jeremiah Mahler, May 21, 2014
  3. Junio C HamanoMay 21, 2014
  4. Junio C HamanoMay 21, 2014
  5. Jeremiah MahlerMay 21, 2014
  6. Jeremiah MahlerMay 21, 2014
  7. Junio C HamanoMay 21, 2014
  8. Jeff KingMay 21, 2014
  9. Junio C HamanoMay 21, 2014
  10. Jeremiah MahlerMay 21, 2014
  11. Junio C HamanoMay 21, 2014
  12. Jeremiah MahlerMay 21, 2014
  13. Junio C HamanoMay 21, 2014
  14. Jeremiah MahlerMay 21, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.