chiark / gitweb /
Better handling of binary files (bug #8495)
authorCatalin Marinas <catalin.marinas@gmail.com>
Sun, 9 Dec 2007 23:32:58 +0000 (23:32 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sun, 9 Dec 2007 23:32:58 +0000 (23:32 +0000)
The patch adds the '--binary' option to the git-diff-tree and git-diff-index
commands. The git-apply no longer needs this flag as it is set by default.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/git.py

index 27d2595cec458045e3b3518d2af8a5bec4f8f091..deb5efcfe7654896a3abcd12e36a5711726a0743 100644 (file)
@@ -767,11 +767,14 @@ def merge(base, head1, head2, recursive = False):
     if errors:
         raise GitException, 'GIT index merging failed (possible conflicts)'
 
-def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = []):
+def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = [],
+         binary = True):
     """Show the diff between rev1 and rev2
     """
     if not files:
         files = []
+    if binary and '--binary' not in diff_flags:
+        diff_flags = diff_flags + ['--binary']
 
     if rev1 and rev2:
         return GRun('diff-tree', '-p',