git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-svn: trim leading and trailing whitespaces in author name
@ 2019-09-12 11:52 Tobias Klauser
  2019-09-12 14:47 ` Eric Sunshine
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Klauser @ 2019-09-12 11:52 UTC (permalink / raw)
  To: git; +Cc: gitster

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 <user1@example.com>

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

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 perl/Git/SVN.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 76b29659057d..db412c653d1d 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -1491,6 +1491,7 @@ sub call_authors_prog {
 
 sub check_author {
 	my ($author) = @_;
+	$author =~ s/^\s+|\s+$//g;
 	if (!defined $author || length $author == 0) {
 		$author = '(no author)';
 	}
-- 
2.23.0.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] git-svn: trim leading and trailing whitespaces in author name
@ 2019-09-23  9:55 Tobias Klauser
  0 siblings, 0 replies; 4+ messages in thread
From: Tobias Klauser @ 2019-09-23  9:55 UTC (permalink / raw)
  To: gitster; +Cc: git, Eric Sunshine

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 <user1@example.com>

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

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 perl/Git/SVN.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 76b29659057d..4b28b8778474 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -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)';
 	}
-- 
2.23.0.257.gbff4bb1fe750


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-23  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 11:52 [PATCH] git-svn: trim leading and trailing whitespaces in author name Tobias Klauser
2019-09-12 14:47 ` Eric Sunshine
2019-09-12 14:51   ` Tobias Klauser
  -- strict thread matches above, loose matches on Subject: below --
2019-09-23  9:55 Tobias Klauser

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).