git-svn: allow empty email-address using authors-prog and authors-file

The email address in --authors-file and --authors-prog can be empty but
git-svn translated it into a fictional email address in the form

	jondoe <jondoe@6aafaa21e0fb4338a68ab372a049893d>

containing the SVN repository UUID. Now git-svn behaves like git-commit:
If the email is *explicitly* set to the empty string using '<>', the
commit does not contain an email address, only the name:

	jondoe <>

Allowing to remove the email address *intentionally* prevents automatic
systems from sending emails to those fictional addresses and avoids
cluttering the log output with unnecessary stuff.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Eric Wong <e@80x24.org>
This commit is contained in:
Andreas Heiduk
2018-03-24 11:20:46 +01:00
committed by Eric Wong
parent 9c18398f8b
commit cb427e9eb0
4 changed files with 50 additions and 11 deletions

View File

@ -9,7 +9,9 @@ test_description='git svn authors prog tests'
write_script svn-authors-prog "$PERL_PATH" <<-\EOF
$_ = shift;
if (s/-sub$//) {
if (s/-hermit//) {
print "$_ <>\n";
} elsif (s/-sub$//) {
print "$_ <$_\@sub.example.com>\n";
} else {
print "$_ <$_\@example.com>\n";
@ -68,6 +70,28 @@ test_expect_success 'authors-file overrode authors-prog' '
git --git-dir=x/.git config --unset svn.authorsfile
git --git-dir=x/.git config --unset svn.authorsprog
test_expect_success 'authors-prog imported user without email' '
svn mkdir -m gg --username gg-hermit "$svnrepo"/gg &&
(
cd x &&
git svn fetch --authors-prog=../svn-authors-prog &&
git rev-list -1 --pretty=raw refs/remotes/git-svn | \
grep "^author gg <> "
)
'
test_expect_success 'imported without authors-prog and authors-file' '
svn mkdir -m hh --username hh "$svnrepo"/hh &&
(
uuid=$(svn info "$svnrepo" |
sed -n "s/^Repository UUID: //p") &&
cd x &&
git svn fetch &&
git rev-list -1 --pretty=raw refs/remotes/git-svn | \
grep "^author hh <hh@$uuid> "
)
'
test_expect_success 'authors-prog handled special characters in username' '
svn mkdir -m bad --username "xyz; touch evil" "$svnrepo"/bad &&
(