Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15
STALE3745d

[PATCH] git-svn: parse authors file more leniently

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:06:29
Subsystem: the rest · Maintainer: Linus Torvalds

Currently, git-svn parses an authors file using the perl regex

/^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.+)>\s*$/

in order to extract svn user name, real name and e-mail.
This does not match an empty e-mail field like "<>". On the other hand,
the output of an authors-prog is parsed with the perl regex

/^\s*(.+?)\s*<(.*)>\s*$/

in order to extract real name and e-mail.

So, specifying a trivial file grep such as

grep "$1" /tmp/authors | head -n 1 | cut -d'=' -f2 | cut -c'2-'

as the authors prog gives different results compared to specifying
/tmp/authors as the authors file directly.

Instead, make git svn uses the perl regex

/^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.*)>\s*$/

for parsing the authors file so that the same (slightly more lenient)
regex is used in both cases.

Reported-by: Till Schäfer <redacted>
Signed-off-by: Michael J Gruber <redacted>
---
 git-svn.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-svn.perl b/git-svn.perl
index 36f7240..fa5f253 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1924,7 +1924,7 @@ sub load_authors {
 	my $log = $cmd eq 'log';
 	while (<$authors>) {
 		chomp;
-		next unless /^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.+)>\s*$/;
+		next unless /^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.*)>\s*$/;
 		my ($user, $name, $email) = ($1, $2, $3);
 		if ($log) {
 			$Git::SVN::Log::rusers{"$name <$email>"} = $user;
-- 
2.6.0.rc0.178.g4177fa5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help