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

@ -1482,7 +1482,6 @@ sub call_authors_prog {
}
if ($author =~ /^\s*(.+?)\s*<(.*)>\s*$/) {
my ($name, $email) = ($1, $2);
$email = undef if length $2 == 0;
return [$name, $email];
} else {
die "Author: $orig_author: $::_authors_prog returned "
@ -2020,8 +2019,8 @@ sub make_log_entry {
remove_username($full_url);
$log_entry{metadata} = "$full_url\@$r $uuid";
$log_entry{svm_revision} = $r;
$email ||= "$author\@$uuid";
$commit_email ||= "$author\@$uuid";
$email = "$author\@$uuid" unless defined $email;
$commit_email = "$author\@$uuid" unless defined $commit_email;
} elsif ($self->use_svnsync_props) {
my $full_url = canonicalize_url(
add_path_to_url( $self->svnsync->{url}, $self->path )
@ -2029,15 +2028,15 @@ sub make_log_entry {
remove_username($full_url);
my $uuid = $self->svnsync->{uuid};
$log_entry{metadata} = "$full_url\@$rev $uuid";
$email ||= "$author\@$uuid";
$commit_email ||= "$author\@$uuid";
$email = "$author\@$uuid" unless defined $email;
$commit_email = "$author\@$uuid" unless defined $commit_email;
} else {
my $url = $self->metadata_url;
remove_username($url);
my $uuid = $self->rewrite_uuid || $self->ra->get_uuid;
$log_entry{metadata} = "$url\@$rev " . $uuid;
$email ||= "$author\@" . $uuid;
$commit_email ||= "$author\@" . $uuid;
$email = "$author\@$uuid" unless defined $email;
$commit_email = "$author\@$uuid" unless defined $commit_email;
}
$log_entry{name} = $name;
$log_entry{email} = $email;