From 8bad45199fc55501b9d9636a238d15482f434609 Mon Sep 17 00:00:00 2001 Message-Id: <8bad45199fc55501b9d9636a238d15482f434609.1714650320.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 13 Sep 2009 16:17:53 +0100 Subject: [PATCH] Generate binary diffs by default Organization: Straylight/Edgeware From: Catalin Marinas This patch modifies the Repository.diff_tree() function to generate binary diffs by default. This way commands like 'export' would generate patches containing the full information. Signed-off-by: Catalin Marinas --- stgit/lib/git.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stgit/lib/git.py b/stgit/lib/git.py index 6e3bb4f..65d2a6c 100644 --- a/stgit/lib/git.py +++ b/stgit/lib/git.py @@ -642,7 +642,7 @@ class Repository(RunWithEnv): return None finally: index.delete() - def diff_tree(self, t1, t2, diff_opts): + def diff_tree(self, t1, t2, diff_opts, binary = True): """Given two L{Tree}s C{t1} and C{t2}, return the patch that takes C{t1} to C{t2}. @@ -652,7 +652,10 @@ class Repository(RunWithEnv): @return: Patch text""" assert isinstance(t1, Tree) assert isinstance(t2, Tree) - return self.run(['git', 'diff-tree', '-p'] + list(diff_opts) + diff_opts = list(diff_opts) + if binary and not '--binary' in diff_opts: + diff_opts.append('--binary') + return self.run(['git', 'diff-tree', '-p'] + diff_opts + [t1.sha1, t2.sha1]).raw_output() def diff_tree_files(self, t1, t2): """Given two L{Tree}s C{t1} and C{t2}, iterate over all files for -- [mdw]