git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Witten <mfwitten@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: "  during --compose
Date: Sat, 11 Apr 2009 15:45:53 -0500	[thread overview]
Message-ID: <b4087cc50904111345v4787f38al9d7d234de8a6d24e@mail.gmail.com> (raw)
In-Reply-To: <7vprfjf11h.fsf@gitster.siamese.dyndns.org>

On Sat, Apr 11, 2009 at 14:22, Junio C Hamano <gitster@pobox.com> wrote:
> Michael Witten <mfwitten@gmail.com> writes:
>
>> This should make things a little more robust in terms of user input;
>> before, even the program got it wrong by outputting a line with only
>> "GIT:", which was left in place as a header, because there would be
>> no following space character.
>
> An alternative could be to add an extra space after the "GIT:" on the
> lines the compose template generated by this program, but people can set
> their editors to strip trailing whitespaces, so I think yours is a better
> approach.  I suspect this patch comes from your own experience of getting
> bitten by this once, perhaps?

My first thought was indeed just to add an extra space, but it occurred to me
that it's not easily remembered. Consider the original documentation:

> If the body of the message (what you type after the headers and a blank line) only contains blank (or GIT: prefixed) lines the summary won't be sent

>> Also, I cleaned up get_patch_subject().
>
> Which is a bit iffy.  It does not belong to the primary topic of the patch
> to begin with, so it shouldn't be in here even if it weren't iffy.

I can split it into another patch.

> Because "while (<>)" does not localize $_, you are clobbering it in the
> caller's context.  I do not know if any of the the existing callers cares,
> but it is a change in behaviour.

How about:

    while (local $_ = <$fh>)

Or, in our case, this:

    while (my $_ = <$fh>)

In testing these, I came across behavior that I think is incorrect, and I
have a mind to complain about it to the perl guys:

# Well! the print `function' doesn't seem to play by the rules.

# Example 0
# I expect the output to be:
# 1
# 1
# 3
# and I am right!

$_ = 3;

{
  local $_ = 1;
  print; print "\n";
  print $_; print "\n";
}

print; print "\n";

##############################################

# Example 1
# I expect the output to be:
# 3
# 1
# 3
# But it is:
# 1
# 1
# 3

$_ = 3;

{
  my $_ = 1;
  print; print "\n";
  print $_; print "\n";
}

print; print "\n";

###############################################

# Example 2
# I expect the output to be:
# 1
# 1
# 3
# and I am right!

sub my_print {
  print(shift or $_);
}

$_ = 3;

{
  local $_ = 1;
  my_print; print "\n";
  my_print $_; print "\n";
}

my_print; print "\n";

###############################################

# Example 3
# I expect the output to be:
# 3
# 1
# 3
# and I am right this time!

sub my_print {
  print(shift or $_);
}

$_ = 3;

{
  my $_ = 1;
  my_print; print "\n";
  my_print $_; print "\n";
}

my_print; print "\n";

  reply	other threads:[~2009-04-11 20:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 21:25 [PATCH RFC 1/6] send-email: Add --delay for separating emails Michael Witten
2009-04-07 21:25 ` [PATCH RFC 2/6] send-email: --smtp-server-port should take an integer Michael Witten
2009-04-07 21:25   ` [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: " during --compose Michael Witten
2009-04-07 21:25     ` [PATCH RFC 4/6] send-email: --compose takes optional argument to existing file Michael Witten
2009-04-07 21:25       ` [PATCH RFC 5/6] send-email: Cleanup the usage text a bit Michael Witten
2009-04-07 21:25         ` [PATCH RFC 6/6] send-email: Remove horrible mix of tabs and spaces Michael Witten
2009-04-07 21:35           ` demerphq
2009-04-07 21:42             ` Michael Witten
2009-04-07 21:44               ` demerphq
2009-04-07 21:57                 ` demerphq
2009-04-07 22:00               ` Jeff King
2009-04-07 22:10                 ` Andreas Ericsson
2009-04-07 23:33                   ` Tomas Carnecky
2009-04-08  2:02                   ` Jeff King
2009-04-11 19:22         ` [PATCH RFC 5/6] send-email: Cleanup the usage text a bit Junio C Hamano
2009-04-11 19:22       ` [PATCH RFC 4/6] send-email: --compose takes optional argument to existing file Junio C Hamano
2009-04-11 19:22     ` [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: " during --compose Junio C Hamano
2009-04-11 20:45       ` Michael Witten [this message]
2009-04-12  0:59         ` Junio C Hamano
2009-04-12  2:36           ` Michael Witten
2009-04-07 23:20   ` [PATCH RFC 2/6] send-email: --smtp-server-port should take an integer Junio C Hamano
2009-04-11 19:22   ` Junio C Hamano
2009-04-11 21:01     ` Wesley J. Landaker
2009-04-11 21:07       ` Michael Witten
2009-04-07 21:51 ` [PATCH RFC 1/6] send-email: Add --delay for separating emails Jeff King
2009-04-07 22:08   ` [PATCH RFC 1/6] " Nicolas Sebrecht
2009-04-07 22:17     ` Andreas Ericsson
2009-04-08  6:05       ` Jeff King
2009-04-08  6:03     ` Jeff King
2009-04-07 23:17 ` [PATCH RFC 1/6] " Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4087cc50904111345v4787f38al9d7d234de8a6d24e@mail.gmail.com \
    --to=mfwitten@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).