git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [updated PATCH] Same default as cvsimport when using --use-log-author

From
Andy Whitcroft <apw@shadowen.org>
Date
Apr 29, 2008, 09:52 UTC
Message-ID
<20080429095213.GY5401@shadowen.org>
In-Reply-To
<20080429061823.GE24171@muzzle>
On Mon, Apr 28, 2008 at 11:18:23PM -0700, Eric Wong wrote:
Show 49 quoted lines
> 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.

Show 30 quoted lines
> $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
Previous: Eric WongNext: Stephen R. van den Berg
Message 4 of 8 in “Same default as cvsimport when using --use-log-author”
  1. Same default as cvsimport when using --use-log-authorStephen R. van den Berg, Apr 27, 2008
  2. Junio C HamanoApr 27, 2008
  3. Eric WongApr 29, 2008
  4. Andy WhitcroftApr 29, 2008
  5. Stephen R. van den BergApr 29, 2008
  6. git-svn: Same default as cvsimport when using --use-log-authorStephen R. van den Berg, Apr 29, 2008
  7. Eric WongMay 1, 2008
  8. Johannes SchindelinApr 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.