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:Author: foobaruser <unknown>
This patches harmonises the result with cvsimport, and makes
git-svn --use-log-author produce:Author: foobaruser <foobaruser>
Signed-off-by: Stephen R. van den Berg <srb@cuci.nl>
---git-svn.perl | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)diff --git a/git-svn.perl b/git-svn.perl
index b151049..846e739 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2434,6 +2434,9 @@ sub make_log_entry {
} else {
($name, $email) = ($name_field, 'unknown');
}
+ if (!defined $email) {
+ $email = $name;
+ }
}
if (defined $headrev && $self->use_svm_props) {
if ($self->rewrite_root) {--
Hi,
could we have a oneline description which is more descriptive in gitweb,
please? Something like "git-svn: use the same default for
--use-log-author as cvsimport"?Thanks,
Dscho--
I would think not -- if that is the case, the codepath you added as a fix
would not trigger. Which means in some other cases, the 'unknown' we see
above in the context also still happens. Is it a good thing? Maybe we
would also want to make it consistently do "somebody <somebody>" instead,
by doing...} else {
$name = $name_field;
}
if (!defined $email) {
$email = $name;
}--
I don't think Stephen's patch ever gets triggered, either.
This section of code was done by Andy, so I can't tell his motivations
for using 'unknown' the way he did.$email does appear to get set correctly for the first two elsifs cases
here in the existing code:if (!defined $name_field) {
#
} elsif ($name_field =~ /(.*?)\s+<(.*)>/) {
($name, $email) = ($1, $2);
} elsif ($name_field =~ /(.*)@/) {
($name, $email) = ($1, $name_field);
} else {
($name, $email) = ($name_field, $name_field);So I propose the following one-line change instead of Stephen's:
diff --git a/git-svn.perl b/git-svn.perl
index b151049..301a5b4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2432,7 +2432,7 @@ sub make_log_entry {
} elsif ($name_field =~ /(.*)@/) {
($name, $email) = ($1, $name_field);
} else {
- ($name, $email) = ($name_field, 'unknown');
+ ($name, $email) = ($name_field, $name_field);
}
}
if (defined $headrev && $self->use_svm_props) {--
Eric Wong
--
I have to correct myself here. What happens is that if in the commit
message there is no From: or Signed-off-by: to be found to parse, that
results in an empty $name_field, and causes $email to stay undefined,
which eventually results in the same silly generated UUID-domain I'm
trying to get rid of.Well, it is triggered, but rather because $name_field is empty, and
That is a good change (IMO), but I still need my patch (or something
similar) to cover the undefined $name_field case. Proposed new patch
follows.
--
Sincerely, srb@cuci.nl
Stephen R. van den Berg."There's a lot to be said for not saying a lot."
--
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: Stephen R. van den Berg <srb@cuci.nl>
---git-svn.perl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)diff --git a/git-svn.perl b/git-svn.perl
index b151049..67726c1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2426,13 +2426,15 @@ sub make_log_entry {
$name_field = $1;
}
if (!defined $name_field) {
- #
+ if (!defined $email) {
+ $email = $name;
+ }
} elsif ($name_field =~ /(.*?)\s+<(.*)>/) {
($name, $email) = ($1, $2);
} elsif ($name_field =~ /(.*)@/) {
($name, $email) = ($1, $name_field);
} else {
- ($name, $email) = ($name_field, 'unknown');
+ ($name, $email) = ($name_field, $name_field);
}
}
if (defined $headrev && $self->use_svm_props) {--
Thanks Stephen,
--
My motivation was that we had picked up a field which is supposed to be
in RFC822 From: format, ie Name <email>, and dispite trying pretty hard
we had not been able to find something that looked like an email to put
in the email field of the git author et al. So we didn't really know,
hence 'unknown'.That said it is not at all clear that putting 'unknown' in this field to
avoid putting an invalid email in this field makes much sense as it of
itself is just as invalid. So I would probabally be just as happy with-apw
--
