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

pretend-sha1: grave bugfix.

We stashed away objects that we pretend to have, but did not save the actual data. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 15, 2007 at 17:02 UTC efa13f7b7ea1605deab3a6478fa0d0706c828170
1 file changed +3 -1
sha1_file.c
+3 -1
@@ -1545,11 +1545,13 @@ int pretend_sha1_file(void *buf, unsigned long len, const char *type, unsigned c
1545 co = &cached_objects[cached_object_nr++];
1546 co->size = len;
1547 co->type = strdup(type);
1548 + co->buf = xmalloc(len);
1549 + memcpy(co->buf, buf, len);
1550 hashcpy(co->sha1, sha1);
1551 return 0;
1552 }
1553
1552 -void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
1554 +void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
1555 {
1556 unsigned long mapsize;
1557 void *map, *buf;