{"thread":{"id":"35883","subject":"[PATCH] git-contacts: do not fail parsing of good diffs","startedAt":"2014-02-15T17:24:50Z","lastAt":"2014-02-21T00:07:34Z","messageCount":3,"participants":["Lars Gullik Bjønnes","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"234860","messageId":"m3wqgw2srh.fsf@black.gullik.net","threadId":"35883","inReplyTo":null,"subject":"[PATCH] git-contacts: do not fail parsing of good diffs","fromName":"Lars Gullik Bjønnes","fromEmail":"larsbj@gullik.org","sentAt":"2014-02-15T17:24:50Z","receivedAt":"2014-02-15T17:24:50Z","isPatch":true,"sender":{"key":"larsbj@gullik.org","avatar":"https://avatars.githubusercontent.com/u/15680184?v=4"},"body":"\nIf a line in a patch starts with \"--- \" it will be deemed\nmalformed unless it also contains the proper diff header\nformat. This situation can happen with a valid patch if\nit has a line starting with \"-- \" and that line is removed.\n\nThis patch just removes the check in git-contacts.\n\nSigned-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>\n---\n contrib/contacts/git-contacts | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts\nindex 428cc1a..dbe2abf 100755\n--- a/contrib/contacts/git-contacts\n+++ b/contrib/contacts/git-contacts\n@@ -96,8 +96,6 @@ sub scan_patches {\n                next unless $id;\n                if (m{^--- (?:a/(.+)|/dev/null)$}) {\n                        $source = $1;\n-               } elsif (/^--- /) {\n-                       die \"Cannot parse hunk source: $_\\n\";\n                } elsif (/^@@ -(\\d+)(?:,(\\d+))?/ && $source) {\n                        my $len = defined($2) ? $2 : 1;\n                        push @{$sources->{$source}{$id}}, [$1, $len] if $len;\n-- \n1.9.0\n\n-- \n\tLgb\n"},{"id":"235038","messageId":"xmqqppmkau9n.fsf@gitster.dls.corp.google.com","threadId":"35883","inReplyTo":"m3wqgw2srh.fsf@black.gullik.net","subject":"Re: [PATCH] git-contacts: do not fail parsing of good diffs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-18T23:14:12Z","receivedAt":"2014-02-18T23:14:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"larsbj@gullik.org (Lars Gullik Bjønnes) writes:\n\n> If a line in a patch starts with \"--- \" it will be deemed\n> malformed unless it also contains the proper diff header\n> format. This situation can happen with a valid patch if\n> it has a line starting with \"-- \" and that line is removed.\n>\n> This patch just removes the check in git-contacts.\n>\n> Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>\n> ---\n\nIf the script wanted to be \"more correct\", it should be paying\nattention to the $len it already parses out of the hunk headers to\nmake sure it does not mistake removal of a line that begins with \"--\n\" as the beginning of a patch to a different path, but as the\noriginal does not seem to aim to be so careful anyway, this change\nshould be OK, I would say.\n\nThe patch was whitespace damaged, by the way.  It was easy to hand\ntweak so there is no need to resend this particular patch, but if\nyou are planning to send more patches, please check your MUA and\ntell it not to.\n\nThanks.\n\n>  contrib/contacts/git-contacts | 2 --\n>  1 file changed, 2 deletions(-)\n>\n> diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts\n> index 428cc1a..dbe2abf 100755\n> --- a/contrib/contacts/git-contacts\n> +++ b/contrib/contacts/git-contacts\n> @@ -96,8 +96,6 @@ sub scan_patches {\n>                 next unless $id;\n>                 if (m{^--- (?:a/(.+)|/dev/null)$}) {\n>                         $source = $1;\n> -               } elsif (/^--- /) {\n> -                       die \"Cannot parse hunk source: $_\\n\";\n>                 } elsif (/^@@ -(\\d+)(?:,(\\d+))?/ && $source) {\n>                         my $len = defined($2) ? $2 : 1;\n>                         push @{$sources->{$source}{$id}}, [$1, $len] if $len;\n> -- \n> 1.9.0\n"},{"id":"235116","messageId":"CAOYg4Ax=i3h7mgNxhDsV_OKz12SOWJumh8ub6vuYEr6NN3+FJw@mail.gmail.com","threadId":"35883","inReplyTo":"xmqqppmkau9n.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] git-contacts: do not fail parsing of good diffs","fromName":"Lars Gullik Bjønnes","fromEmail":"larsbj@gullik.org","sentAt":"2014-02-21T00:07:34Z","receivedAt":"2014-02-21T00:07:34Z","isPatch":true,"sender":{"key":"larsbj@gullik.org","avatar":"https://avatars.githubusercontent.com/u/15680184?v=4"},"body":"On 19 February 2014 00:14, Junio C Hamano <gitster@pobox.com> wrote:\n[...]\n> The patch was whitespace damaged, by the way.  It was easy to hand\n> tweak so there is no need to resend this particular patch, but if\n> you are planning to send more patches, please check your MUA and\n> tell it not to.\n\nSuits me right for doing cut-n-paste. Emacs/Gnus usually does not do\nstupid things\nlike that.\n\nThanks.\n"}]}