From 85759056690e4b0a11635c4df97f5a7e4d1f8087 Mon Sep 17 00:00:00 2001 From: "James E. Blair" <jeblair@linux.vnet.ibm.com> Date: Wed, 10 Feb 2016 07:52:34 -0800 Subject: [PATCH] Fix unicode regression regressions 8377e0a went a bit too far and removed some code that was necessary for 3.4 but broke some utf-8 in git commits. This restores most of what that removed, with one change that causes it to work with the test commits listed at the top of the file. Change-Id: Id39d7799f9c210a0ff0a80aeef34681eb6fe5770 --- gertty/gitrepo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gertty/gitrepo.py b/gertty/gitrepo.py index cb93cef..f7fb91c 100644 --- a/gertty/gitrepo.py +++ b/gertty/gitrepo.py @@ -413,7 +413,11 @@ class Repo(object): oldchunk = [] newchunk = [] prev_key = '' - diff_lines = diff_context.diff.split('\n') + if isinstance(diff_context.diff, six.string_types): + diff_text = diff_context.diff + else: + diff_text = diff_context.diff.decode('utf-8') + diff_lines = diff_text.split('\n') for i, line in enumerate(diff_lines): last_line = (i == len(diff_lines)-1) if line.startswith('---'):