{"thread":{"id":"51842","subject":"[PATCH v3] git-svn: trim leading and trailing whitespaces in author name","startedAt":"2019-09-13T12:08:54Z","lastAt":"2019-09-13T12:08:54Z","messageCount":1,"participants":["Tobias Klauser"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"382289","messageId":"20190913120851.23656-1-tklauser@distanz.ch","threadId":"51842","inReplyTo":null,"subject":"[PATCH v3] git-svn: trim leading and trailing whitespaces in author name","fromName":"Tobias Klauser","fromEmail":"tklauser@distanz.ch","sentAt":"2019-09-13T12:08:51Z","receivedAt":"2019-09-13T12:08:54Z","isPatch":true,"sender":{"key":"tklauser@distanz.ch","avatar":"https://avatars.githubusercontent.com/u/539708?v=4"},"body":"In some cases, the svn author names might contain leading or trailing\nwhitespaces, leading to messages such as:\n\n  Author: user1\n   not defined in authors.txt\n\n(the trailing newline leads to the line break). The user \"user1\" is\ndefined in authors.txt though, e.g.\n\n  user1 = User <user1@example.com>\n\nFix this by trimming the author name retreived from svn before using it\nin check_author.\n\nSigned-off-by: Tobias Klauser <tklauser@distanz.ch>\n---\nv3:\n - check author string length after whitespace trimming\n - trim leading and trailing whitespaces in two separate steps\n\n perl/Git/SVN.pm | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 76b29659057d..4b28b8778474 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1491,6 +1491,10 @@ sub call_authors_prog {\n \n sub check_author {\n \tmy ($author) = @_;\n+\tif (defined $author) {\n+\t\t$author =~ s/^\\s+//g;\n+\t\t$author =~ s/\\s+$//g;\n+\t}\n \tif (!defined $author || length $author == 0) {\n \t\t$author = '(no author)';\n \t}\n-- \n2.23.0.1.g588b4aa4a322.dirty\n\n"}]}