All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeremiah Mahler <jmmahler@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v6] format-patch --signature-file <file>
Date: Wed, 21 May 2014 15:37:11 -0700	[thread overview]
Message-ID: <xmqqbnuqoj1k.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140521221221.GC13956@hudson.localdomain> (Jeremiah Mahler's message of "Wed, 21 May 2014 15:12:21 -0700")

Jeremiah Mahler <jmmahler@gmail.com> writes:

> Below is one of the updated test cases.
>
> test_expect_success 'format-patch --signature-file=mail-signature' '
> 	cat >mail-signature <<-\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
> 	git format-patch --stdout --signature-file=mail-signature -1 >output &&
> 	check_patch output &&
> 	sed -n -e "/^-- $/,\$p" <output | sed -e "1d" | sed -e "\$d" >output2 &&
> 	test_cmp mail-signature output2
> '

Hmph, there are still few things I do not understand in the above.

 * Why does mail-signature file have a leading blank line?  Is it
   typical users would want to have one there?

 * Similarly, why does mail-signature file need a trailing blank
   line?  Is it usual users would want to have one there?

 * Why three sed in the pipeline?  Wouldn't

    sed -e "1,/^-- \$/d" <output | ...

   be more direct way to start the pipeline without having to strip
   the "-- \n" line with the extra one?

 * Given a mail-signature file that does not end with an incomplete
   line (i.e. we did not have to add the newline to make it
   complete), what are the expected lines in the output after the
   "-- \n" separator?

   Whatever it is, I think it is easier to read the tests if done
   like so:

     sed -e "1,/^-- \$/d" <output >actual &&
     {
         do something to turn mail-signature to what we expect
     } >expect &&
     test_cmp expect actual

   If that "do something" is "to append an extra newline", then it
   would make it a lot clear to do

     {
         cat mail-signature && echo
     } >expect

   than a 'sed -e "\$d"' tucked at the end of the pipeline that only
   tells us we are removing one line that has _something_ without
   explicitly saying what we are removing, no?

Thanks.



   

  reply	other threads:[~2014-05-21 22:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21  1:02 [PATCH v6] format-patch --signature-file <file> Jeremiah Mahler
2014-05-21  1:02 ` Jeremiah Mahler
2014-05-21 21:13   ` Junio C Hamano
2014-05-21 21:24     ` Junio C Hamano
2014-05-21 21:32       ` Jeremiah Mahler
2014-05-21 21:50     ` Jeremiah Mahler
2014-05-21 21:58       ` Junio C Hamano
2014-05-21 22:02         ` Jeff King
2014-05-21 22:15           ` Junio C Hamano
2014-05-21 22:27             ` Jeremiah Mahler
2014-05-21 22:48               ` Junio C Hamano
2014-05-21 22:12         ` Jeremiah Mahler
2014-05-21 22:37           ` Junio C Hamano [this message]
2014-05-21 23:18             ` Jeremiah Mahler

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=xmqqbnuqoj1k.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jmmahler@gmail.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.