Re: [PATCH 7/7] cvsserver: Use the user part of the email in log and annotate results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/03/2008, Frank Lichtenheld <frank@xxxxxxxxxxxxxx> wrote:
> On Mon, Mar 24, 2008 at 11:50:55PM +0100, Damien Diederen wrote:
>  > +# Generate a CVS author name from Git author information, by taking
>  > +# the first eight characters of the user part of the email address.
>  > +sub cvs_author
>  > +{
>  > +    my $author = shift;
>  > +
>  > +    $author =~ s/.*<([^>]+)\@[^>]+>$/$1/;
>  > +    $author =~ s/^(.{8}).*/$1/;
>
>
> IMHO substr($author, 0, 8) would be easier to read here. (It is also
>  much faster according to some quick benchmarks I just ran)

While we're at nitpicking:
Faster, shorter, and probably more robust if no @ appears in the email address:

my $author_line = shift;
(my $author) = $author_line =~ /<([^>@]{1,8})/;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux