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

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

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 10, 2015, 12:32 UTC
Message-ID
<03f07c11135aef9e04a26e5b1018d726ba2fab5d.1441887195.git.git@drmicha.warpmail.net>
In-Reply-To
<5613050.3arVUQYvEz@granit>
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 <till2.schaefer@tu-dortmund.de>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 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
Previous: Till SchäferNext: Eric Wong
Message 4 of 7 in “git clone svn: authors from authors file are ignored, authors-prog works, but crashes on branch points”
  1. Till SchäferAug 26, 2015
  2. Michael J GruberSep 10, 2015
  3. Till SchäferSep 10, 2015
  4. git-svn: parse authors file more lenientlyMichael J Gruber, Sep 10, 2015
  5. Eric WongSep 10, 2015
  6. Junio C HamanoSep 10, 2015
  7. Michael J GruberSep 11, 2015

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.