@matheusbsbs / matheus-bagliano / commits / d4c452f03b
Fork 0

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>

Junio C Hamano committed Aug 16, 2006 at 16:08 UTC d4c452f03b49072ebb46fc524e6d85056a35ef13
1 file changed +8 -2
diff.c
+8 -2
@@ -838,7 +838,7 @@ static unsigned char *deflate_it(char *data,
838 return deflated;
839 }
840
841 -static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
841 +static void emit_binary_diff_body(mmfile_t *one, mmfile_t *two)
842 {
843 void *cp;
844 void *delta;
@@ -849,7 +849,6 @@ static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
849 unsigned long deflate_size;
850 unsigned long data_size;
851
852 - printf("GIT binary patch\n");
852 /* We could do deflated delta, or we could do just deflated two,
853 * whichever is smaller.
854 */
@@ -898,6 +897,13 @@ static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
897 free(data);
898 }
899
900 +static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
901 +{
902 + printf("GIT binary patch\n");
903 + emit_binary_diff_body(one, two);
904 + emit_binary_diff_body(two, one);
905 +}
906 +
907 #define FIRST_FEW_BYTES 8000
908 static int mmfile_is_binary(mmfile_t *mf)
909 {