diff options
author | Junio C Hamano <junkio@cox.net> | 2007-02-15 17:02:06 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-15 17:03:11 -0800 |
commit | efa13f7b7ea1605deab3a6478fa0d0706c828170 (patch) | |
tree | f56e6ddc8cb6e359bc199cd72eb7f40aa0ae2995 /sha1_file.c | |
parent | 204d409247e7bbc7848569462aa11a87e373c8d6 (diff) | |
download | git-efa13f7b7ea1605deab3a6478fa0d0706c828170.tar.gz git-efa13f7b7ea1605deab3a6478fa0d0706c828170.tar.xz |
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>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index b83f59f38..2c870314d 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1545,11 +1545,13 @@ int pretend_sha1_file(void *buf, unsigned long len, const char *type, unsigned c co = &cached_objects[cached_object_nr++]; co->size = len; co->type = strdup(type); + co->buf = xmalloc(len); + memcpy(co->buf, buf, len); hashcpy(co->sha1, sha1); return 0; } -void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size) +void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size) { unsigned long mapsize; void *map, *buf; |