Commit Diff


commit - 282f42e5d1095015379b49280429e558b3bbc4fe
commit + 51a494da48acb57ed84501a6d10f39ed624c711e
blob - 0b023fb4330314246e6a110ad5aade625f8b9a0f
blob + 5249f06a3d371504ab13da934648a6a7e7afe141
--- lib/deltify.c
+++ lib/deltify.c
@@ -121,9 +121,9 @@ addblk(struct got_delta_table *dt, FILE *f, off_t len,
 		/*
 		 * Avoid adding duplicate blocks.
 		 * NB: A matching hash is insufficient for detecting equality.
-		 * The hash can only detect inequality, so only check 'len'.
+		 * The hash can only detect inequality.
 		 */
-		if (len == dt->blocks[i].len) {
+		if (len == dt->blocks[i].len && h == dt->blocks[i].hash) {
 			uint8_t buf2[GOT_DELTIFY_MAXCHUNK];
 			if (fseeko(f, dt->blocks[i].offset, SEEK_SET) == -1)
 				return got_error_from_errno("fseeko");