From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 94C721F406 for ; Mon, 8 Jan 2018 11:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756648AbeAHL5J (ORCPT ); Mon, 8 Jan 2018 06:57:09 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35033 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756612AbeAHL5H (ORCPT ); Mon, 8 Jan 2018 06:57:07 -0500 Received: by mail-wm0-f65.google.com with SMTP id a79so13703284wma.0 for ; Mon, 08 Jan 2018 03:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=xjGAb1L7PLmME50akAlUF0+43kGpDuXjwpZ/9WD/VSs=; b=cSzk/eVi5Wi8Obaanq4vMRXbNnOM0+Ay1WLNRPSdmdaZrBChsfeTUo9z6I936blDcA jbupKAjVSsYqaS+10iiV7/5Dau5BeYOpMT/oFi9cWTelfEwOZhGCKTE2/Yaglp8VyPS3 zIU1P230yaz7QcIwwJ8ch/3rZGThdXBJZOqu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=xjGAb1L7PLmME50akAlUF0+43kGpDuXjwpZ/9WD/VSs=; b=tmYvMc6UOlitAs4tJjvSg8NDWkhla+9Cb1l5QKl2/ZdEdRBr3yGxKQaDz0VHIDEER+ 33Jh0ILlFEbn4YI4EE+VxytpWLrfQ8fVl3jRHrXH3rF+ZW3BS5vT60W28LgVQfF6ruBH P5eviC8lQowUgk6K+Xb0vJJrojXsm8NHkicauSnoyCPwLuOyVwfkYxNNSk+RA+okLh3i b6mUBO7vwrhOj7b9byYdpCR0m9Mr7h7V4cbSQjYeCPWCaeCZpKg2Fg4sfknR0GWbBug1 KfZmVri86XCvDRyi51l2AyttX2pNcmBbu3XW9rueS6w0aiSpyU9zWiTSMoV2PO81sg0n l7bA== X-Gm-Message-State: AKGB3mLfcyg8fldlYBwwhdmj4H+SDATh99X30cxehNtACNBvzjUABY9X 0ozcV9ju309yIAok/+Tl0d4/og== X-Google-Smtp-Source: ACJfBoui4ykmkpNDwCPWPQjBun1WR5+uMl6ijhBXF/WRUXBBddNj68C4V1RTQ3BuKszP7wisxdVNAg== X-Received: by 10.28.141.18 with SMTP id p18mr9143893wmd.143.1515412626524; Mon, 08 Jan 2018 03:57:06 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a69sm10587554wma.25.2018.01.08.03.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 03:57:05 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTPS id 2FE853E037F; Mon, 8 Jan 2018 11:57:05 +0000 (GMT) References: <1515177413-12526-1-git-send-email-git@matthieu-moy.fr> <1515407674-5233-1-git-send-email-git@matthieu-moy.fr> <1515407674-5233-2-git-send-email-git@matthieu-moy.fr> User-agent: mu4e 1.0-alpha3; emacs 26.0.90 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Matthieu Moy Cc: gitster@pobox.com, git@vger.kernel.org, Eric Sunshine , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Thomas Adam Subject: Re: [PATCH v3 2/3] Remove now useless email-address parsing code In-reply-to: <1515407674-5233-2-git-send-email-git@matthieu-moy.fr> Date: Mon, 08 Jan 2018 11:57:05 +0000 Message-ID: <87h8rwo966.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Matthieu Moy writes: > We now use Mail::Address unconditionaly, hence parse_mailboxes is now > dead code. Remove it and its tests. > > Signed-off-by: Matthieu Moy Reviewed-by: Alex Benn=C3=A9e > --- > No change since v2. > > perl/Git.pm | 71 ----------------------------------------------= ------ > t/t9000-addresses.sh | 27 -------------------- > t/t9000/test.pl | 67 ----------------------------------------------= --- > 3 files changed, 165 deletions(-) > delete mode 100755 t/t9000-addresses.sh > delete mode 100755 t/t9000/test.pl > > diff --git a/perl/Git.pm b/perl/Git.pm > index ffa09ac..65e6b32 100644 > --- a/perl/Git.pm > +++ b/perl/Git.pm > @@ -880,77 +880,6 @@ sub ident_person { > return "$ident[0] <$ident[1]>"; > } > > -=3Ditem parse_mailboxes > - > -Return an array of mailboxes extracted from a string. > - > -=3Dcut > - > -# Very close to Mail::Address's parser, but we still have minor > -# differences in some cases (see t9000 for examples). > -sub parse_mailboxes { > - my $re_comment =3D qr/\((?:[^)]*)\)/; > - my $re_quote =3D qr/"(?:[^\"\\]|\\.)*"/; > - my $re_word =3D qr/(?:[^]["\s()<>:;@\\,.]|\\.)+/; > - > - # divide the string in tokens of the above form > - my $re_token =3D qr/(?:$re_quote|$re_word|$re_comment|\S)/; > - my @tokens =3D map { $_ =3D~ /\s*($re_token)\s*/g } @_; > - my $end_of_addr_seen =3D 0; > - > - # add a delimiter to simplify treatment for the last mailbox > - push @tokens, ","; > - > - my (@addr_list, @phrase, @address, @comment, @buffer) =3D (); > - foreach my $token (@tokens) { > - if ($token =3D~ /^[,;]$/) { > - # if buffer still contains undeterminated strings > - # append it at the end of @address or @phrase > - if ($end_of_addr_seen) { > - push @phrase, @buffer; > - } else { > - push @address, @buffer; > - } > - > - my $str_phrase =3D join ' ', @phrase; > - my $str_address =3D join '', @address; > - my $str_comment =3D join ' ', @comment; > - > - # quote are necessary if phrase contains > - # special characters > - if ($str_phrase =3D~ /[][()<>:;@\\,.\000-\037\177]/) { > - $str_phrase =3D~ s/(^|[^\\])"/$1/g; > - $str_phrase =3D qq["$str_phrase"]; > - } > - > - # add "<>" around the address if necessary > - if ($str_address ne "" && $str_phrase ne "") { > - $str_address =3D qq[<$str_address>]; > - } > - > - my $str_mailbox =3D "$str_phrase $str_address $str_comment"; > - $str_mailbox =3D~ s/^\s*|\s*$//g; > - push @addr_list, $str_mailbox if ($str_mailbox); > - > - @phrase =3D @address =3D @comment =3D @buffer =3D (); > - $end_of_addr_seen =3D 0; > - } elsif ($token =3D~ /^\(/) { > - push @comment, $token; > - } elsif ($token eq "<") { > - push @phrase, (splice @address), (splice @buffer); > - } elsif ($token eq ">") { > - $end_of_addr_seen =3D 1; > - push @address, (splice @buffer); > - } elsif ($token eq "@" && !$end_of_addr_seen) { > - push @address, (splice @buffer), "@"; > - } else { > - push @buffer, $token; > - } > - } > - > - return @addr_list; > -} > - > =3Ditem hash_object ( TYPE, FILENAME ) > > Compute the SHA1 object id of the given C considering it is > diff --git a/t/t9000-addresses.sh b/t/t9000-addresses.sh > deleted file mode 100755 > index a1ebef6..0000000 > --- a/t/t9000-addresses.sh > +++ /dev/null > @@ -1,27 +0,0 @@ > -#!/bin/sh > - > -test_description=3D'compare address parsing with and without Mail::Addre= ss' > -. ./test-lib.sh > - > -if ! test_have_prereq PERL; then > - skip_all=3D'skipping perl interface tests, perl not available' > - test_done > -fi > - > -perl -MTest::More -e 0 2>/dev/null || { > - skip_all=3D"Perl Test::More unavailable, skipping test" > - test_done > -} > - > -perl -MMail::Address -e 0 2>/dev/null || { > - skip_all=3D"Perl Mail::Address unavailable, skipping test" > - test_done > -} > - > -test_external_has_tap=3D1 > - > -test_external_without_stderr \ > - 'Perl address parsing function' \ > - perl "$TEST_DIRECTORY"/t9000/test.pl > - > -test_done > diff --git a/t/t9000/test.pl b/t/t9000/test.pl > deleted file mode 100755 > index dfeaa9c..0000000 > --- a/t/t9000/test.pl > +++ /dev/null > @@ -1,67 +0,0 @@ > -#!/usr/bin/perl > -use lib (split(/:/, $ENV{GITPERLLIB})); > - > -use 5.008; > -use warnings; > -use strict; > - > -use Test::More qw(no_plan); > -use Mail::Address; > - > -BEGIN { use_ok('Git') } > - > -my @success_list =3D (q[Jane], > - q[jdoe@example.com], > - q[], > - q[Jane ], > - q[Jane Doe ], > - q["Jane" ], > - q["Doe, Jane" ], > - q["Jane@:;\>.,()], > - q[Jane!#$%&'*+-/=3D?^_{|}~Doe' ], > - q[""], > - q["Jane jdoe@example.com"], > - q[Jane Doe ], > - q[Jane Doe < jdoe@example.com >], > - q[Jane @ Doe @ Jane @ Doe], > - q["Jane, 'Doe'" ], > - q['Doe, "Jane' ], > - q["Jane" "Do"e ], > - q["Jane' Doe" ], > - q["Jane Doe " ], > - q["Jane\" Doe" ], > - q[Doe, jane ], > - q["Jane Doe ], > - q['Jane 'Doe' ], > - q[Jane@:;\.,()<>Doe ], > - q[Jane Doe], > - q[ Jane Doe]); > - > -my @known_failure_list =3D (q[Jane\ Doe ], > - q["Doe, Ja"ne ], > - q["Doe, Katarina" Jane ], > - q[Jane jdoe@example.com], > - q["Jane "Kat"a" ri"na" ",Doe" ], > - q[Jane Doe], > - q[Jane "Doe "], > - q[\"Jane Doe ], > - q[Jane\"\" Doe ], > - q['Jane "Katarina\" \' Doe' ]); > - > -foreach my $str (@success_list) { > - my @expected =3D map { $_->format } Mail::Address->parse("$str"); > - my @actual =3D Git::parse_mailboxes("$str"); > - is_deeply(\@expected, \@actual, qq[same output : $str]); > -} > - > -TODO: { > - local $TODO =3D "known breakage"; > - foreach my $str (@known_failure_list) { > - my @expected =3D map { $_->format } Mail::Address->parse("$str"); > - my @actual =3D Git::parse_mailboxes("$str"); > - is_deeply(\@expected, \@actual, qq[same output : $str]); > - } > -} > - > -my $is_passing =3D eval { Test::More->is_passing }; > -exit($is_passing ? 0 : 1) unless $@ =3D~ /Can't locate object method/; -- Alex Benn=C3=A9e