Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=727bc5fe188ff79f75054fc05298ea2003996120

commit 727bc5fe188ff79f75054fc05298ea2003996120
Author: VMiklos <[EMAIL PROTECTED]>
Date:   Tue Sep 11 20:24:49 2007 +0200

dg: initial support for binary files

diff --git a/darcs-git.py b/darcs-git.py
index d4587d2..c2a1c71 100755
--- a/darcs-git.py
+++ b/darcs-git.py
@@ -77,7 +77,7 @@ def get_root():
return root

def get_diff(files = ""):
-       sock = os.popen("git diff HEAD %s" % files)
+       sock = os.popen("git diff HEAD --binary %s" % files)
lines = sock.readlines()
sock.close()
if len(lines) and lines[0].startswith(""):
@@ -109,10 +109,12 @@ def scan_dir(files=""):
header = []
hunk = []
file = None
+       binary = False
for i in lines:
if i.startswith("#"):
continue
elif i.startswith("diff"):
+                       binary = False
if inhunk:
file.hunks.append("".join(hunk))
hunk = []
@@ -128,7 +130,9 @@ def scan_dir(files=""):
header.append(i)
if i == "--- /dev/null\n":
file.new = True
-               elif i.startswith("@@"):
+               elif i.startswith("@@") or i.startswith("GIT binary patch"):
+                       if i.startswith("GIT binary patch"):
+                               binary = True
if inheader:
inheader = False
file.header = "".join(header)
@@ -138,7 +142,7 @@ def scan_dir(files=""):
hunk = []
inhunk = True
hunk.append(i)
-               elif i[0] == "+" or i[0] == "-" or i[0] == " ":
+               elif i[0] == "+" or i[0] == "-" or i[0] == " " or binary:
if inhunk:
hunk.append(i)
else:
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to