From f2aacf177a54a93601682ba072b392b31f324a57 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 5 Sep 2014 12:44:26 -0700 Subject: [PATCH] Have git not colorize output for diffs We need more control over diff colorization for proper rendering and processing. Ensure that local settings don't cause us to blow up when we're doing it. Change-Id: I07fc445d9328c9df1ed52e8b328cce6fbea78f43 --- gertty/gitrepo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gertty/gitrepo.py b/gertty/gitrepo.py index 3e43224..a83d379 100644 --- a/gertty/gitrepo.py +++ b/gertty/gitrepo.py @@ -267,7 +267,7 @@ class Repo(object): def diffstat(self, old, new): repo = git.Repo(self.path) - diff = repo.git.diff('-M', '--numstat', old, new) + diff = repo.git.diff('-M', '--color=never', '--numstat', old, new) ret = [] for x in diff.split('\n'): # Added, removed, filename @@ -360,7 +360,8 @@ class Repo(object): else: extra_contexts.append(CommitContext(None, newc)) contexts = itertools.chain( - extra_contexts, oldc.diff(newc, create_patch=True, U=context)) + extra_contexts, oldc.diff( + newc, color='never',create_patch=True, U=context)) for diff_context in contexts: # Each iteration of this is a file f = DiffFile()