summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ffd97f3)
raw | patch | inline | side by side (parent: ffd97f3)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 15 Jan 2006 11:30:30 +0000 (03:30 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 16 Jan 2006 05:13:22 +0000 (21:13 -0800) |
This fixes a minor bug, which caused the author email to be
doubly enclosed in a <> pair (the code gave enclosing <> to
GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL environment variable).
The read_author_info() subroutine is taught to also understand
the user list in CVSROOT/users format. This is primarily done
to ease migration for CVS users, who can use the -A option
to read from existing CVSROOT/users file. write_author_info()
always writes in the git-cvsimport's native format ('='
delimited and value without quotes).
Signed-off-by: Junio C Hamano <junkio@cox.net>
doubly enclosed in a <> pair (the code gave enclosing <> to
GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL environment variable).
The read_author_info() subroutine is taught to also understand
the user list in CVSROOT/users format. This is primarily done
to ease migration for CVS users, who can use the -A option
to read from existing CVSROOT/users file. write_author_info()
always writes in the git-cvsimport's native format ('='
delimited and value without quotes).
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cvsimport.perl | patch | blob | history |
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 8d493c2a4fb057aa650cc34858253838d408660e..fc207fc47e2860f9d8b1ed4154596b6e8d897a11 100755 (executable)
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
open my $f, '<', "$file" or die("Failed to open $file: $!\n");
while (<$f>) {
- chomp;
- # Expected format is this;
+ # Expected format is this:
# exon=Andreas Ericsson <ae@op5.se>
- if (m/^([^ \t=]*)[ \t=]*([^<]*)(<.*$)\s*/) {
+ if (m/^(\S+?)\s*=\s*(.+?)\s*<(.+)>\s*$/) {
$user = $1;
- $conv_author_name{$1} = $2;
- $conv_author_email{$1} = $3;
- # strip trailing whitespace from author name
- $conv_author_name{$1} =~ s/\s*$//;
+ $conv_author_name{$user} = $2;
+ $conv_author_email{$user} = $3;
}
+ # However, we also read from CVSROOT/users format
+ # to ease migration.
+ elsif (/^(\w+):(['"]?)(.+?)\2\s*$/) {
+ my $mapped;
+ ($user, $mapped) = ($1, $3);
+ if ($mapped =~ /^\s*(.*?)\s*<(.*)>\s*$/) {
+ $conv_author_name{$user} = $1;
+ $conv_author_email{$user} = $2;
+ }
+ elsif ($mapped =~ /^<?(.*)>?$/) {
+ $conv_author_name{$user} = $user;
+ $conv_author_email{$user} = $1;
+ }
+ }
+ # NEEDSWORK: Maybe warn on unrecognized lines?
}
close ($f);
}
die("Failed to open $file for writing: $!");
foreach (keys %conv_author_name) {
- print $f "$_=" . $conv_author_name{$_} .
- " " . $conv_author_email{$_} . "\n";
+ print $f "$_=$conv_author_name{$_} <$conv_author_email{$_}>\n";
}
close ($f);
}