提交 abfa533d 编写于 作者: S Stephen R. van den Berg 提交者: Junio C Hamano

git-svn: Same default as cvsimport when using --use-log-author

When using git-cvsimport, the author is inferred from the cvs commit,
e.g. cvs commit logname is foobaruser, then the author field in git
results in:

Author: foobaruser <foobaruser>

Which is not perfect, but perfectly acceptable given the circumstances.

The default git-svn import however, results in:

Author: foobaruser <foobaruser@acf43c95-373e-0410-b603-e72c3f656dc1>

When using mixes of imports, from CVS and SVN into the same git
repository, you'd like to harmonise the imports to the format cvsimport
uses.
git-svn supports an experimental option --use-log-author which currently
results in the same logentry as without that option when no From: or
Signed-off-by: is found in the logentry ($email currently ends up empty,
and hence is generated again).

This patches harmonises the result with cvsimport, and makes
git-svn --use-log-author produce:

Author: foobaruser <foobaruser>
Signed-off-by: NStephen R. van den Berg <srb@cuci.nl>
Acked-by: NEric Wong <normalperson@yhbt.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e4b9c36c
...@@ -2428,13 +2428,15 @@ sub make_log_entry { ...@@ -2428,13 +2428,15 @@ sub make_log_entry {
$name_field = $1; $name_field = $1;
} }
if (!defined $name_field) { if (!defined $name_field) {
# if (!defined $email) {
$email = $name;
}
} elsif ($name_field =~ /(.*?)\s+<(.*)>/) { } elsif ($name_field =~ /(.*?)\s+<(.*)>/) {
($name, $email) = ($1, $2); ($name, $email) = ($1, $2);
} elsif ($name_field =~ /(.*)@/) { } elsif ($name_field =~ /(.*)@/) {
($name, $email) = ($1, $name_field); ($name, $email) = ($1, $name_field);
} else { } else {
($name, $email) = ($name_field, 'unknown'); ($name, $email) = ($name_field, $name_field);
} }
} }
if (defined $headrev && $self->use_svm_props) { if (defined $headrev && $self->use_svm_props) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册