git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-svn: expand handling of From: and Signed-off-by:
@ 2007-12-13  6:58 Andy Whitcroft
  2007-12-13 16:32 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2007-12-13  6:58 UTC (permalink / raw)
  To: git; +Cc: Eric Wong

The current parsing for From: and Signed-off-by: lines handles fully
specified names:

	From: Full Name <email@address>

Expand this to include the raw email addresses and straight "names":

	From: email@address       -> email <email@address>
	From: Full Name           -> Full Name <unknown>

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 git-svn.perl |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 54d7844..058f8e9 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2363,11 +2363,20 @@ sub make_log_entry {
 
 	my ($commit_name, $commit_email) = ($name, $email);
 	if ($_use_log_author) {
-		if ($log_entry{log} =~ /From:\s+(.*?)\s+<(.*)>\s*\n/) {
-			($name, $email) = ($1, $2);
-		} elsif ($log_entry{log} =~
-		                      /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
+		my $name_field;
+		if ($log_entry{log} =~ /From:\s+(.*\S)\s*\n/i) {
+			$name_field = $1;
+		} elsif ($log_entry{log} =~ /Signed-off-by:\s+(.*\S)\s*\n/i) {
+			$name_field = $1;
+		}
+		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, 'unknown');
 		}
 	}
 	if (defined $headrev && $self->use_svm_props) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: git-svn: expand handling of From: and Signed-off-by:
  2007-12-13  6:58 git-svn: expand handling of From: and Signed-off-by: Andy Whitcroft
@ 2007-12-13 16:32 ` Eric Wong
  2007-12-14  8:21   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2007-12-13 16:32 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: git, Junio C Hamano

Andy Whitcroft <apw@shadowen.org> wrote:
> The current parsing for From: and Signed-off-by: lines handles fully
> specified names:
> 
> 	From: Full Name <email@address>
> 
> Expand this to include the raw email addresses and straight "names":
> 
> 	From: email@address       -> email <email@address>
> 	From: Full Name           -> Full Name <unknown>
> 
> Signed-off-by: Andy Whitcroft <apw@shadowen.org>

Some minor whitespace damage (which Junio can fix up), but
Acked-by: Eric Wong <normalperson@yhbt.net>

Thanks Andy.

> ---
>  git-svn.perl |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
> diff --git a/git-svn.perl b/git-svn.perl
> index 54d7844..058f8e9 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -2363,11 +2363,20 @@ sub make_log_entry {
>  
>  	my ($commit_name, $commit_email) = ($name, $email);
>  	if ($_use_log_author) {
> -		if ($log_entry{log} =~ /From:\s+(.*?)\s+<(.*)>\s*\n/) {
> -			($name, $email) = ($1, $2);
> -		} elsif ($log_entry{log} =~
> -		                      /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
> +		my $name_field;
> +		if ($log_entry{log} =~ /From:\s+(.*\S)\s*\n/i) {
> +			$name_field = $1;
> +		} elsif ($log_entry{log} =~ /Signed-off-by:\s+(.*\S)\s*\n/i) {
> +			$name_field = $1;
> +		}
> +		if (!defined $name_field) {
> +			#
> +		} elsif ($name_field =~ /(.*?)\s+<(.*)>/) {
>  			($name, $email) = ($1, $2);
> +        	} elsif ($name_field =~ /(.*)@/) {
    ^ spaces before tab here

> +			($name, $email) = ($1, $name_field);
> +		} else {
> +			($name, $email) = ($name_field, 'unknown');
>  		}
>  	}
>  	if (defined $headrev && $self->use_svm_props) {

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git-svn: expand handling of From: and Signed-off-by:
  2007-12-13 16:32 ` Eric Wong
@ 2007-12-14  8:21   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-12-14  8:21 UTC (permalink / raw)
  To: Eric Wong; +Cc: Andy Whitcroft, git

Eric Wong <normalperson@yhbt.net> writes:

> Some minor whitespace damage (which Junio can fix up), but
> Acked-by: Eric Wong <normalperson@yhbt.net>
>
> Thanks Andy.

Thanks, applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-14  8:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13  6:58 git-svn: expand handling of From: and Signed-off-by: Andy Whitcroft
2007-12-13 16:32 ` Eric Wong
2007-12-14  8:21   ` Junio C Hamano

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).