threads / discuss / 11271

git-svn: expand handling of From: and Signed-off-by:

Subject: git-svn: expand handling of From: and Signed-off-by:

## tl;dr

3 messages between Dec 13, 2007 and Dec 14, 2007.

replies: 2people: 3as markdown or json

Andy Whitcroft· Dec 13, 2007, 06:58 UTC · lore

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) {
Eric Wong· Dec 13, 2007, 16:32 UTC · re: Andy Whitcroft · lore

Re: git-svn: expand handling of From: and Signed-off-by:

Andy Whitcroft <apw@shadowen.org> wrote:
Show 11 quoted lines
> 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.
Show 26 quoted lines
> ---
>  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
Show 6 quoted lines
> +			($name, $email) = ($1, $name_field);
> +		} else {
> +			($name, $email) = ($name_field, 'unknown');
>  		}
>  	}
>  	if (defined $headrev && $self->use_svm_props) {
-- 
Eric Wong
Junio C Hamano· Dec 14, 2007, 08:21 UTC · re: Eric Wong · lore

Re: git-svn: expand handling of From: and Signed-off-by:

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.

← back to recent threads