git (post-receive-alternativearch): use unicode for git output

The commit message and diff is stored in `full_change` as a string, via
`read_output()`.  This is passed to `TEXT` which is a unicode string.

When a commit message or diff contains non-ascii characters we get:

    UnicodeDecodeError: 'ascii' codec can't decode byte ...

Encode git output returned from `read_output()` as a unicode string and
define `full_change` as unicode for completeness.

Fixes #6040.
This commit is contained in:
Todd Zullinger 2017-12-23 02:31:58 -05:00 committed by Pierre-Yves Chibon
parent f388a20a82
commit 476ca97e74

View file

@ -66,7 +66,7 @@ def read_output(cmd, abspath, input=None, keepends=False, **kw):
print(err)
if not keepends:
out = out.rstrip('\n\r')
return out
return out.decode('utf-8')
def read_git_output(args, abspath, input=None, keepends=False, **kw):
@ -164,7 +164,7 @@ def run_as_post_receive_hook():
if DEBUG:
print('List of commits:', new_commits_list)
full_change = ''
full_change = u''
exclude_arch = {}
for commit in new_commits_list:
if DEBUG: