git-common: Explicitly specify utf-8 when encoding.
Bug: 1012773
Change-Id: I95006ce78b4473c8fb435162089a787b57c0f835
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1850926
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_common.py b/git_common.py
index e022ff3..24c178c 100644
--- a/git_common.py
+++ b/git_common.py
@@ -605,7 +605,7 @@
"""
with tempfile.TemporaryFile() as f:
for name, (mode, typ, ref) in treedict.items():
- f.write(('%s %s %s\t%s\0' % (mode, typ, ref, name)).encode())
+ f.write(('%s %s %s\t%s\0' % (mode, typ, ref, name)).encode('utf-8'))
f.seek(0)
return run('mktree', '-z', stdin=f)
@@ -862,7 +862,7 @@
# nothing to commit at this point.
print('Nothing to commit; squashed branch is empty')
return False
- run('commit', '--no-verify', '-a', '-F', '-', indata=log_msg.encode())
+ run('commit', '--no-verify', '-a', '-F', '-', indata=log_msg.encode('utf-8'))
return True