@matheusbsbs / matheus-bagliano / commits / d500a1ee8f
Fork 0

cvsserver: change generation of CVS author names

CVS username is generated from local part email address. We take the whole local part but restrict the character set to the Portable Filename Character Set, which is used for Unix login names according to Single Unix Specification v3. This will obviously report different usernames from existing repositories for commits with the local part of the author e-mail address that contains characters outside the PFCS. Hopefully this won't break an old CVS checkout from an earlier version of git-cvsserver, because the names are always shown afresh to the CVS clients and not kept on the client side. Signed-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de> Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fabian Emmes committed Jan 2, 2009 at 16:40 UTC d500a1ee8fe4424beb7a98e4fa6159677e7569d0
1 file changed +9 -3
git-cvsserver.perl
+9 -3
@@ -2533,12 +2533,18 @@ sub open_blob_or_die
2533 return $fh;
2534 }
2535
2536 -# Generate a CVS author name from Git author information, by taking
2537 -# the first eight characters of the user part of the email address.
2536 +# Generate a CVS author name from Git author information, by taking the local
2537 +# part of the email address and replacing characters not in the Portable
2538 +# Filename Character Set (see IEEE Std 1003.1-2001, 3.276) by underscores. CVS
2539 +# Login names are Unix login names, which should be restricted to this
2540 +# character set.
2541 sub cvs_author
2542 {
2543 my $author_line = shift;
2541 - (my $author) = $author_line =~ /<([^>@]{1,8})/;
2544 + (my $author) = $author_line =~ /<([^@>]*)/;
2545 +
2546 + $author =~ s/[^-a-zA-Z0-9_.]/_/g;
2547 + $author =~ s/^-/_/;
2548
2549 $author;
2550 }