summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-16 23:08:14 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-17 04:08:45 (GMT)
commitd4c452f03b49072ebb46fc524e6d85056a35ef13 (patch)
tree9d930125a3c9c2b46deb31d9f97edb4e21a62405 /diff.c
parent03eb8f8aeb8a483b11b797cca012fdded818a5c1 (diff)
downloadgit-d4c452f03b49072ebb46fc524e6d85056a35ef13.zip
git-d4c452f03b49072ebb46fc524e6d85056a35ef13.tar.gz
git-d4c452f03b49072ebb46fc524e6d85056a35ef13.tar.bz2
diff.c: make binary patch reversible.
This matches the format previous "git-apply --reverse" update expects. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 7a238d0..b816196 100644
--- a/diff.c
+++ b/diff.c
@@ -838,7 +838,7 @@ static unsigned char *deflate_it(char *data,
return deflated;
}
-static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
+static void emit_binary_diff_body(mmfile_t *one, mmfile_t *two)
{
void *cp;
void *delta;
@@ -849,7 +849,6 @@ static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
unsigned long deflate_size;
unsigned long data_size;
- printf("GIT binary patch\n");
/* We could do deflated delta, or we could do just deflated two,
* whichever is smaller.
*/
@@ -898,6 +897,13 @@ static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
free(data);
}
+static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
+{
+ printf("GIT binary patch\n");
+ emit_binary_diff_body(one, two);
+ emit_binary_diff_body(two, one);
+}
+
#define FIRST_FEW_BYTES 8000
static int mmfile_is_binary(mmfile_t *mf)
{