Only decode email if already encoded
* gertty/gitrepo.py(CommitContext.decorateMessage): A regression was introduced by 3e23dba where some platforms already used unicode for the author.email and committer.email values. In those circumstances attempting to decode from UTF-8 fails spectacularly, so now we only decode when we need to. Change-Id: I267a4cb7ff35a8c864a7f3396abd5bf44ecd1ffc
This commit is contained in:
parent
bfb5deff32
commit
12edc3aaf9
@ -83,12 +83,18 @@ class CommitContext(object):
|
||||
commit.authored_date, commit.author_tz_offset)
|
||||
commit_date = self.decorateGitTime(
|
||||
commit.committed_date, commit.committer_tz_offset)
|
||||
if type(author.email) is unicode:
|
||||
author_email = author.email
|
||||
else:
|
||||
author_email = unicode(author.email, 'utf8')
|
||||
if type(committer.email) is unicode:
|
||||
committer_email = committer.email
|
||||
else:
|
||||
committer_email = unicode(committer.email, 'utf8')
|
||||
return [u"Parent: %s\n" % parentsha,
|
||||
u"Author: %s <%s>\n" % (author.name,
|
||||
unicode(author.email, 'utf8')),
|
||||
u"Author: %s <%s>\n" % (author.name, author_email),
|
||||
u"AuthorDate: %s\n" % author_date,
|
||||
u"Commit: %s <%s>\n" % (committer.name,
|
||||
unicode(committer.email, 'utf')),
|
||||
u"Commit: %s <%s>\n" % (committer.name, committer_email),
|
||||
u"CommitDate: %s\n" % commit_date,
|
||||
u"\n"] + commit.message.splitlines(True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user