* [updated PATCH] Same default as cvsimport when using --use-log-author @ 2008-04-27 17:32 Stephen R. van den Berg 2008-04-27 20:47 ` Junio C Hamano 2008-04-28 10:15 ` [updated PATCH] " Johannes Schindelin 0 siblings, 2 replies; 8+ messages in thread From: Stephen R. van den Berg @ 2008-04-27 17:32 UTC (permalink / raw) To: git 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) { ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [updated PATCH] Same default as cvsimport when using --use-log-author 2008-04-27 17:32 [updated PATCH] Same default as cvsimport when using --use-log-author Stephen R. van den Berg @ 2008-04-27 20:47 ` Junio C Hamano 2008-04-29 6:18 ` Eric Wong 2008-04-28 10:15 ` [updated PATCH] " Johannes Schindelin 1 sibling, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2008-04-27 20:47 UTC (permalink / raw) To: Stephen R. van den Berg; +Cc: git, Eric Wong "Stephen R. van den Berg" <srb@cuci.nl> writes: > git-svn supports an experimental option --use-log-author which currently > results in: > > Author: foobaruser <unknown> I have a question about this. Is the "<unknown> coming from... > This patches harmonises the result with cvsimport, and makes > git-svn --use-log-author produce: > > Author: foobaruser <foobaruser> > ... > 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'); > } ... this 'unknown' we see here? > + if (!defined $email) { > + $email = $name; > + } > } 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; } ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [updated PATCH] Same default as cvsimport when using --use-log-author 2008-04-27 20:47 ` Junio C Hamano @ 2008-04-29 6:18 ` Eric Wong 2008-04-29 9:52 ` Andy Whitcroft 2008-04-29 21:13 ` Stephen R. van den Berg 0 siblings, 2 replies; 8+ messages in thread From: Eric Wong @ 2008-04-29 6:18 UTC (permalink / raw) To: Junio C Hamano; +Cc: Stephen R. van den Berg, git, Andy Whitcroft Junio C Hamano <gitster@pobox.com> wrote: > "Stephen R. van den Berg" <srb@cuci.nl> writes: > > > git-svn supports an experimental option --use-log-author which currently > > results in: > > > > Author: foobaruser <unknown> > > I have a question about this. Is the "<unknown> coming from... > > > This patches harmonises the result with cvsimport, and makes > > git-svn --use-log-author produce: > > > > Author: foobaruser <foobaruser> > > ... > > 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'); > > } > > ... this 'unknown' we see here? > > > + if (!defined $email) { > > + $email = $name; > > + } > > } > > 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [updated PATCH] Same default as cvsimport when using --use-log-author 2008-04-29 6:18 ` Eric Wong @ 2008-04-29 9:52 ` Andy Whitcroft 2008-04-29 21:13 ` Stephen R. van den Berg 1 sibling, 0 replies; 8+ messages in thread From: Andy Whitcroft @ 2008-04-29 9:52 UTC (permalink / raw) To: Eric Wong; +Cc: Junio C Hamano, Stephen R. van den Berg, git On Mon, Apr 28, 2008 at 11:18:23PM -0700, Eric Wong wrote: > Junio C Hamano <gitster@pobox.com> wrote: > > "Stephen R. van den Berg" <srb@cuci.nl> writes: > > > > > git-svn supports an experimental option --use-log-author which currently > > > results in: > > > > > > Author: foobaruser <unknown> > > > > I have a question about this. Is the "<unknown> coming from... > > > > > This patches harmonises the result with cvsimport, and makes > > > git-svn --use-log-author produce: > > > > > > Author: foobaruser <foobaruser> > > > ... > > > 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'); > > > } > > > > ... this 'unknown' we see here? > > > > > + if (!defined $email) { > > > + $email = $name; > > > + } > > > } > > > > 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. 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 your option here. > $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 -apw ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [updated PATCH] Same default as cvsimport when using --use-log-author 2008-04-29 6:18 ` Eric Wong 2008-04-29 9:52 ` Andy Whitcroft @ 2008-04-29 21:13 ` Stephen R. van den Berg 2008-04-29 21:20 ` [updated2 PATCH] git-svn: " Stephen R. van den Berg 1 sibling, 1 reply; 8+ messages in thread From: Stephen R. van den Berg @ 2008-04-29 21:13 UTC (permalink / raw) To: Eric Wong; +Cc: Junio C Hamano, git, Andy Whitcroft Eric Wong wrote: >Junio C Hamano <gitster@pobox.com> wrote: >> "Stephen R. van den Berg" <srb@cuci.nl> writes: >> > git-svn supports an experimental option --use-log-author which currently >> > results in: >> > Author: foobaruser <unknown> >> I have a question about this. Is the "<unknown> coming from... 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. So it's not triggering the 'unknown' above. >> 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... >I don't think Stephen's patch ever gets triggered, either. Well, it is triggered, but rather because $name_field is empty, and consequently $email is never set. >$email does appear to get set correctly for the first two elsifs cases >here in the existing code: >So I propose the following one-line change instead of Stephen's: >diff --git a/git-svn.perl b/git-svn.perl >@@ -2432,7 +2432,7 @@ sub make_log_entry { >- ($name, $email) = ($name_field, 'unknown'); >+ ($name, $email) = ($name_field, $name_field); 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." ^ permalink raw reply [flat|nested] 8+ messages in thread
* [updated2 PATCH] git-svn: Same default as cvsimport when using --use-log-author 2008-04-29 21:13 ` Stephen R. van den Berg @ 2008-04-29 21:20 ` Stephen R. van den Berg 2008-05-01 3:47 ` Eric Wong 0 siblings, 1 reply; 8+ messages in thread From: Stephen R. van den Berg @ 2008-04-29 21:20 UTC (permalink / raw) To: git 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) { ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [updated2 PATCH] git-svn: Same default as cvsimport when using --use-log-author 2008-04-29 21:20 ` [updated2 PATCH] git-svn: " Stephen R. van den Berg @ 2008-05-01 3:47 ` Eric Wong 0 siblings, 0 replies; 8+ messages in thread From: Eric Wong @ 2008-05-01 3:47 UTC (permalink / raw) To: Junio C Hamano; +Cc: git, Stephen R. van den Berg "Stephen R. van den Berg" <srb@cuci.nl> wrote: > 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> Thanks Stephen, Acked-by: Eric Wong <normalperson@yhbt.net> > --- > > 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) { > > > -- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [updated PATCH] Same default as cvsimport when using --use-log-author 2008-04-27 17:32 [updated PATCH] Same default as cvsimport when using --use-log-author Stephen R. van den Berg 2008-04-27 20:47 ` Junio C Hamano @ 2008-04-28 10:15 ` Johannes Schindelin 1 sibling, 0 replies; 8+ messages in thread From: Johannes Schindelin @ 2008-04-28 10:15 UTC (permalink / raw) To: Stephen R. van den Berg; +Cc: git 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-05-01 3:48 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-27 17:32 [updated PATCH] Same default as cvsimport when using --use-log-author Stephen R. van den Berg 2008-04-27 20:47 ` Junio C Hamano 2008-04-29 6:18 ` Eric Wong 2008-04-29 9:52 ` Andy Whitcroft 2008-04-29 21:13 ` Stephen R. van den Berg 2008-04-29 21:20 ` [updated2 PATCH] git-svn: " Stephen R. van den Berg 2008-05-01 3:47 ` Eric Wong 2008-04-28 10:15 ` [updated PATCH] " Johannes Schindelin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).