Skip to content

Commit efa13f7

Browse files
author
Junio C Hamano
committed
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>
1 parent 204d409 commit efa13f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sha1_file.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,11 +1545,13 @@ int pretend_sha1_file(void *buf, unsigned long len, const char *type, unsigned c
15451545
co = &cached_objects[cached_object_nr++];
15461546
co->size = len;
15471547
co->type = strdup(type);
1548+
co->buf = xmalloc(len);
1549+
memcpy(co->buf, buf, len);
15481550
hashcpy(co->sha1, sha1);
15491551
return 0;
15501552
}
15511553

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)
15531555
{
15541556
unsigned long mapsize;
15551557
void *map, *buf;

0 commit comments

Comments
 (0)