diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-02-05 15:22:32 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-02-05 20:46:47 +0000 |
commit | fdb7b2dc0fd5c24d760710fb3247546a83e1628c (patch) | |
tree | 320d843c1d784b18d21e4d5ba9fdd48656461661 /dgit | |
parent | 8c0703a043f1deedc4dee9500d8f7da8b382543a (diff) |
dgit: importing: Better handle commas in changelog maintainer fields
Some maintainers have written commas in the maintainer field of their
changelog entries. Such changelog entries could not be imported.
clogp_authline had code to replace multiple maintainers (which are
hypothetical right now) into just the first, but that trips on these
maintainers with commas.
Ultimately we should expect that the Maintainer: field from
dpkg-parsechangelog is in (a subset of) RFC5322 recipient field
format. In that format, any commas would need to be quoted.
So:
If the Maintainer field from dpkg-parsechangelog has a comma which has
no @ or " before it, then we consider it a single old-school
comma-containing maintainer. If it were intended as multiple
maintainers, then the first maintainer has no email address. Not
coping properly with that very-hypothetical future seems OK. We
simply delete the comma, so that the things we record in the git
history are more conservative.
If there is a " we leave things untouched in the hope that this is a
single address, albeit with some quoting. The alternative would be to
try to use a full RFC5322 parser. That's quite a risky change.
Perhaps we will revisit this after stretch.
For now this Closes:#852661.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1995,7 +1995,14 @@ sub make_commit_text ($) { sub clogp_authline ($) { my ($clogp) = @_; my $author = getfield $clogp, 'Maintainer'; - $author =~ s#,.*##ms; + if ($author =~ m/^[^"\@]+\,/) { + # single entry Maintainer field with unquoted comma + $author = ($& =~ y/,//rd).$'; # strip the comma + } + # git wants a single author; any remaining commas in $author + # are by now preceded by @ (or "). It seems safer to punt on + # "..." for now rather than attempting to dequote or something. + $author =~ s#,.*##ms unless $author =~ m/"/; my $date = cmdoutput qw(date), '+%s %z', qw(-d), getfield($clogp,'Date'); my $authline = "$author $date"; $authline =~ m/$git_authline_re/o or |