{"thread":{"id":"51834","subject":"[PATCH] git-svn: trim leading and trailing whitespaces in author name","startedAt":"2019-09-12T11:58:59Z","lastAt":"2019-09-12T14:51:55Z","messageCount":3,"participants":["Tobias Klauser","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"382211","messageId":"20190912115201.888-1-tklauser@distanz.ch","threadId":"51834","inReplyTo":null,"subject":"[PATCH] git-svn: trim leading and trailing whitespaces in author name","fromName":"Tobias Klauser","fromEmail":"tklauser@distanz.ch","sentAt":"2019-09-12T11:52:01Z","receivedAt":"2019-09-12T11:58:59Z","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---\n perl/Git/SVN.pm | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 76b29659057d..db412c653d1d 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1491,6 +1491,7 @@ sub call_authors_prog {\n \n sub check_author {\n \tmy ($author) = @_;\n+\t$author =~ s/^\\s+|\\s+$//g;\n \tif (!defined $author || length $author == 0) {\n \t\t$author = '(no author)';\n \t}\n-- \n2.23.0.dirty\n\n"},{"id":"382224","messageId":"CAPig+cQ53m0LrmScKnrcddyQzBRw_P=74cJ_H51GGrs8FD4RRg@mail.gmail.com","threadId":"51834","inReplyTo":"20190912115201.888-1-tklauser@distanz.ch","subject":"Re: [PATCH] git-svn: trim leading and trailing whitespaces in author name","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-09-12T14:47:41Z","receivedAt":"2019-09-12T14:47:56Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Sep 12, 2019 at 7:59 AM Tobias Klauser <tklauser@distanz.ch> wrote:\n> In some cases, the svn author names might contain leading or trailing\n> whitespaces, 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\n> defined in authors.txt though, e.g.\n>\n>   user1 = User <user1@example.com>\n>\n> Fix this by trimming the author name retreived from svn before using it\n> in check_author.\n>\n> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>\n> ---\n> diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\n> @@ -1491,6 +1491,7 @@ sub call_authors_prog {\n>  sub check_author {\n>         my ($author) = @_;\n> +       $author =~ s/^\\s+|\\s+$//g;\n>         if (!defined $author || length $author == 0) {\n>                 $author = '(no author)';\n>         }\n\nThis fix seems incomplete. What happens if $author is undefined?\n(There is a check for $author defined'ness just below the new code you\nadd.)\n"},{"id":"382225","messageId":"20190912145151.7ztvovxqatfqmvig@distanz.ch","threadId":"51834","inReplyTo":"CAPig+cQ53m0LrmScKnrcddyQzBRw_P=74cJ_H51GGrs8FD4RRg@mail.gmail.com","subject":"Re: [PATCH] git-svn: trim leading and trailing whitespaces in author name","fromName":"Tobias Klauser","fromEmail":"tklauser@distanz.ch","sentAt":"2019-09-12T14:51:51Z","receivedAt":"2019-09-12T14:51:55Z","isPatch":true,"sender":{"key":"tklauser@distanz.ch","avatar":"https://avatars.githubusercontent.com/u/539708?v=4"},"body":"On 2019-09-12 at 16:47:41 +0200, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Thu, Sep 12, 2019 at 7:59 AM Tobias Klauser <tklauser@distanz.ch> wrote:\n> > In some cases, the svn author names might contain leading or trailing\n> > whitespaces, 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\n> > defined in authors.txt though, e.g.\n> >\n> >   user1 = User <user1@example.com>\n> >\n> > Fix this by trimming the author name retreived from svn before using it\n> > in check_author.\n> >\n> > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>\n> > ---\n> > diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\n> > @@ -1491,6 +1491,7 @@ sub call_authors_prog {\n> >  sub check_author {\n> >         my ($author) = @_;\n> > +       $author =~ s/^\\s+|\\s+$//g;\n> >         if (!defined $author || length $author == 0) {\n> >                 $author = '(no author)';\n> >         }\n> \n> This fix seems incomplete. What happens if $author is undefined?\n> (There is a check for $author defined'ness just below the new code you\n> add.)\n\nRight, thanks for noting. The whitespace trimming should be moved below\nthe defined'ness check. I'll send an updated patch.\n"}]}