summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Pathak <gaurav.pathak@pantacor.com>2021-01-26 18:10:43 +0530
committerMike Frysinger <vapier@google.com>2021-01-28 17:38:24 +0000
commitdb3128f2ec8feedd16f0379aedd39287f4186c54 (patch)
tree4b60f5d5a8be54070cb44a8237d795e68c560d64
parent2a2da80ba6f1a511fbf8f6ffe3800c1455a337d5 (diff)
downloadgit-repo-db3128f2ec8feedd16f0379aedd39287f4186c54.tar.gz
git_command.py: Handle unicode decode error
repo diffmanifests saves git commit messages in buf and uses default utf-8 decoding, in some scenarios git commit message can itself contain a non UTF-8 character due to a typo or incorrect i18n.commitEncoding. e.g. d354d9afe923 [PATCH] fbcon: don\xb4t call set_par() in fbcon_init() if vc_mode == KD_GRAPHICS Convert the buf containing git commits to string if decoding to utf-8 encounters an error. Signed-off-by: Gaurav Pathak <gaurav.pathak@pantacor.com> Change-Id: If818562f0faaa5062c765fbea11dc0e1c86a24d7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/294742 Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r--git_command.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/git_command.py b/git_command.py
index b29d240e..2b3975ec 100644
--- a/git_command.py
+++ b/git_command.py
@@ -395,7 +395,7 @@ class GitCommand(object):
395 s_in.remove(s) 395 s_in.remove(s)
396 continue 396 continue
397 if not hasattr(buf, 'encode'): 397 if not hasattr(buf, 'encode'):
398 buf = buf.decode() 398 buf = buf.decode('utf-8', 'backslashreplace')
399 if s.std_name == 'stdout': 399 if s.std_name == 'stdout':
400 self.stdout += buf 400 self.stdout += buf
401 else: 401 else: