public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: larsbj@gullik•org (Lars Gullik Bjønnes)
Cc: git@vger•kernel.org
Subject: Re: [PATCH] git-contacts: do not fail parsing of good diffs
Date: Tue, 18 Feb 2014 15:14:12 -0800	[thread overview]
Message-ID: <xmqqppmkau9n.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <m3wqgw2srh.fsf@black.gullik.net> ("Lars Gullik Bjønnes"'s message of "Sat, 15 Feb 2014 18:24:50 +0100")

larsbj@gullik•org (Lars Gullik Bjønnes) writes:

> If a line in a patch starts with "--- " it will be deemed
> malformed unless it also contains the proper diff header
> format. This situation can happen with a valid patch if
> it has a line starting with "-- " and that line is removed.
>
> This patch just removes the check in git-contacts.
>
> Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik•org>
> ---

If the script wanted to be "more correct", it should be paying
attention to the $len it already parses out of the hunk headers to
make sure it does not mistake removal of a line that begins with "--
" as the beginning of a patch to a different path, but as the
original does not seem to aim to be so careful anyway, this change
should be OK, I would say.

The patch was whitespace damaged, by the way.  It was easy to hand
tweak so there is no need to resend this particular patch, but if
you are planning to send more patches, please check your MUA and
tell it not to.

Thanks.

>  contrib/contacts/git-contacts | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
> index 428cc1a..dbe2abf 100755
> --- a/contrib/contacts/git-contacts
> +++ b/contrib/contacts/git-contacts
> @@ -96,8 +96,6 @@ sub scan_patches {
>                 next unless $id;
>                 if (m{^--- (?:a/(.+)|/dev/null)$}) {
>                         $source = $1;
> -               } elsif (/^--- /) {
> -                       die "Cannot parse hunk source: $_\n";
>                 } elsif (/^@@ -(\d+)(?:,(\d+))?/ && $source) {
>                         my $len = defined($2) ? $2 : 1;
>                         push @{$sources->{$source}{$id}}, [$1, $len] if $len;
> -- 
> 1.9.0

  reply	other threads:[~2014-02-18 23:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 17:24 [PATCH] git-contacts: do not fail parsing of good diffs Lars Gullik Bjønnes
2014-02-18 23:14 ` Junio C Hamano [this message]
2014-02-21  0:07   ` Lars Gullik Bjønnes

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=xmqqppmkau9n.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=larsbj@gullik$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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