mirror of
https://github.com/git/git.git
synced 2026-02-13 11:21:10 +00:00
remote-hg: another case of Postel's law
This change allows invalid input from Mercurial repositories where the author is recorded as 'Name <email@blah' (missing the closing '>'). With this change, importing http://scelenic.com/hg itself no longer fails with: fatal: Missing > in ident string: Benoit Boissinot <benoit.boissinot@ens-lyon.org <none@none> 1129685868 -0700 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Pat Thoyts
parent
2773579464
commit
fac173a5d8
@@ -76,17 +76,21 @@ class GitHg(object):
|
||||
author = ctx.user()
|
||||
|
||||
# check for git author pattern compliance
|
||||
regex = re.compile('^(.*?) ?\<(.*?)\>(.*)$')
|
||||
regex = re.compile('^(.*?) ?\<(.*?)(|\>(.*))$')
|
||||
a = regex.match(author)
|
||||
|
||||
if a:
|
||||
name = a.group(1)
|
||||
email = a.group(2)
|
||||
if len(a.group(3)) > 0:
|
||||
name += ' ext:(' + urllib.quote(a.group(3)) + ')'
|
||||
extra = a.group(4)
|
||||
if not extra is None and len(extra) > 0:
|
||||
name += ' ext:(' + urllib.quote(extra) + ')'
|
||||
author = name + ' <' + email + '>'
|
||||
else:
|
||||
author = author + ' <none@none>'
|
||||
if author.find('<') >= 0:
|
||||
author = author + '>'
|
||||
else:
|
||||
author = author + ' <none@none>'
|
||||
|
||||
if 'author' in ctx.extra():
|
||||
author = apply_delta(author, ctx.extra()['author'])
|
||||
|
||||
Reference in New Issue
Block a user