tags -1 +patch thanks Hello,
this patch fixes the problem with non-utf8 git commit authors (at least for me :) ) It does that by (temporarily) changing the git output encoding to utf8. This doesn't still ensure the output will be valid utf8 (ie. if invalid utf8 is already in the repository), however, it deals with theproblem with other encodings. Regards Jiri Palecek --- gbp/git/repository.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gbp/git/repository.py b/gbp/git/repository.py index dfc8e55..6607122 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1626,7 +1626,21 @@ class GitRepository(object): paths = [paths] args.add_cond(paths, paths) + # switch git log encoding + oldenc, ret = self._git_getoutput('config', ['--local', 'i18n.logoutputencoding']) + if ret: + oldenc = None + else: + oldenc = oldenc[0].decode()[:-1] + + self._git_command('config', ['--local', 'i18n.logoutputencoding', 'utf-8']) + commits, ret = self._git_getoutput('log', args.args) + if oldenc is None: + self._git_command('config', ['--local', '--unset', 'i18n.logoutputencoding']) + else: + self._git_command('config', ['--local', 'i18n.logoutputencoding', oldenc]) + if ret: where = " on %s" % paths if paths else "" raise GitRepositoryError("Error getting commits %s..%s%s" % @@ -1693,7 +1707,7 @@ class GitRepository(object): """ commit_sha1 = self.rev_parse("%s^0" % commitish) args = GitArgs('--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', - '-z', '--date=raw', '--no-renames', '--name-status', + '-z', '--date=raw', '--no-renames', '--name-status', '--encoding=utf-8', '--no-show-signature', commit_sha1) out, err, ret = self._git_inout('show', args.args) if ret: -- 2.20.1