Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-12 23:01:52 +0300
committerJunio C Hamano <junkio@cox.net>2005-12-12 23:57:25 +0300
commit962537a3eb03a118cf27d9d0da365a3216ed1caa (patch)
treeabc9d37b3200dde75043e757387f665ebce5a023
parente726715a52e25d8035c89d4ea09398599610737e (diff)
diff-delta.c: allow delta with empty blob.
Delta computation with an empty blob used to punt and returned NULL. This commit allows creation with empty blob; all combination of empty->empty, empty->something, and something->empty are allowed. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--delta.h4
-rw-r--r--diff-delta.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/delta.h b/delta.h
index 31d1820f80..c6a476353f 100644
--- a/delta.h
+++ b/delta.h
@@ -9,8 +9,8 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
void *delta_buf, unsigned long delta_size,
unsigned long *dst_size);
-/* the smallest possible delta size is 4 bytes */
-#define DELTA_SIZE_MIN 4
+/* the smallest possible delta size is 2 bytes (empty to empty) */
+#define DELTA_SIZE_MIN 2
/*
* This must be called twice on the delta data buffer, first to get the
diff --git a/diff-delta.c b/diff-delta.c
index b2ae7b5e6c..cf5013896f 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -213,7 +213,7 @@ void *diff_delta(void *from_buf, unsigned long from_size,
bdrecord_t *brec;
bdfile_t bdf;
- if (!from_size || !to_size || delta_prepare(from_buf, from_size, &bdf))
+ if (delta_prepare(from_buf, from_size, &bdf))
return NULL;
outpos = 0;