git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Allen Hubbe <allenbh@gmail.com>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2] send-email: Add simple email aliases format
Date: Thu, 21 May 2015 23:59:38 -0400	[thread overview]
Message-ID: <CAPig+cSDAagVNhdobtTDGrdzLNSxKpOtUhEEDq+NLQZBOoWJxg@mail.gmail.com> (raw)
In-Reply-To: <CAJ80savXAOMAbdDC_F77esD1Fdi=BP6GK4biFOLJTtqqehjEOw@mail.gmail.com>

On Thu, May 21, 2015 at 11:19 PM, Allen Hubbe <allenbh@gmail.com> wrote:
> On May 21, 2015 9:05 PM, "Eric Sunshine" <sunshine@sunshineco.com> wrote:
>> On Thu, May 21, 2015 at 8:16 PM, Allen Hubbe <allenbh@gmail.com> wrote:
>> > +test_expect_success $PREREQ 'sendemail.aliasfiletype=simple' '
>> > +       clean_fake_sendmail && rm -fr outdir &&
>> > +       git format-patch -1 -o outdir &&
>> > +       {
>> > +               echo "alice: Alice W Land <awol@example.com>"
>> > +               echo "bob: Robert Bobbyton <bob@example.com>"
>> > +               echo "chloe: chloe@example.com"
>> > +               echo "abgroup: alice, bob"
>> > +               echo "bcgrp: bob, chloe, Other <o@example.com>"
>> > +       } >~/.tmp-email-aliases &&
>>
>> A here-doc would be easier to maintain and read:
>>
>>     cat >~/.tmp-email-aliases <<-\EOF &&
>>         alice: Alice W Land <awol@example.com>
>>         bob: Robert Bobbyton <bob@example.com>
>>         ...
>>     EOF
>
> A here-doc does not flow nicely in an indented block.  Each line in
> the here-doc will also contain any indentation which may appear to the
> reader to be part of the test case.  Alternatively, the here-doc could
> be indented differently than the surrounding test case (all the way to
> the left column), but that also has a negative impact for readability.
> Finally, the EOF marker can not be indented.

That's true if you use <<EOF here-doc, but not for <<-EOF, as I did in
the example. With <<-EOF, all leading tabs are stripped from the input
lines, including from the EOF line, which is why it can be indented to
the same level as the other code in the test. The added '\' in <<-\EOF
from my example indicates that you don't want/expect any interpolation
inside the here-doc. The <<-\EOF form is used extensively throughout
the Git test suite.

> With echo "string", exactly "string" is output to the line.  The
> operation is obvious to the reader.  The test case can use sane
> indentation, and the resulting output will be exactly what what it
> would appear to be in the test case.

Same with <<-\EOF; plus <<-\EOF content is more readable since it's
not polluted with 'echo' noise.

> Especially for something like a test case where there should be
> absolutely no confusion as to exactly what is the input to the test,
> clarity matters.  Any operation where the result is not immediately
> obvious to the reader, does not belong here.  Therefore, I will keep
> the lines in the test case as echo "string".

  reply	other threads:[~2015-05-22  3:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  0:16 [PATCH v2] send-email: Add simple email aliases format Allen Hubbe
2015-05-22  1:05 ` Eric Sunshine
2015-05-22  3:19   ` Allen Hubbe
2015-05-22  3:59     ` Eric Sunshine [this message]
2015-05-22 12:15       ` Allen Hubbe

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=CAPig+cSDAagVNhdobtTDGrdzLNSxKpOtUhEEDq+NLQZBOoWJxg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=allenbh@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).