Skip to content

Commit

Permalink
git-svn: trim leading and trailing whitespaces in author name
Browse files Browse the repository at this point in the history
In some cases, the svn author names might contain leading or trailing
whitespaces, leading to messages such as:

  Author: user1
   not defined in authors.txt

(the trailing newline leads to the line break). The user "user1" is
defined in authors.txt though, e.g.

  user1 = User <[email protected]>

Fix this by trimming the author name retreived from svn before using it
in check_author.

Helped-by: Eric Sunshine <[email protected]>
Signed-off-by: Tobias Klauser <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
tklauser authored and gitster committed Sep 28, 2019
1 parent 5fa0f52 commit 4ddd4bd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions perl/Git/SVN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,10 @@ sub call_authors_prog {

sub check_author {
my ($author) = @_;
if (defined $author) {
$author =~ s/^\s+//g;
$author =~ s/\s+$//g;
}
if (!defined $author || length $author == 0) {
$author = '(no author)';
}
Expand Down

0 comments on commit 4ddd4bd

Please sign in to comment.