object: call "check_sha1_signature" with the replacement sha1
Otherwise we get a "sha1 mismatch" error for replaced objects. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Jan 23, 2009 at 10:07 UTC
0e87c36763a384d5bf6fae4bda44fd035c0b75ff
1 file changed
+5
-4
object.c
+5
-4
@@ -188,17 +188,18 @@ struct object *parse_object(const unsigned char *sha1)
188
unsigned long size;
189
enum object_type type;
190
int eaten;
191
- void *buffer = read_sha1_file(sha1, &type, &size);
191
+ const unsigned char *repl;
192
+ void *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);
193
194
if (buffer) {
195
struct object *obj;
195
- if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {
196
+ if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
197
free(buffer);
197
- error("sha1 mismatch %s\n", sha1_to_hex(sha1));
198
+ error("sha1 mismatch %s\n", sha1_to_hex(repl));
199
return NULL;
200
}
201
201
- obj = parse_object_buffer(sha1, type, size, buffer, &eaten);
202
+ obj = parse_object_buffer(repl, type, size, buffer, &eaten);
203
if (!eaten)
204
free(buffer);
205
return obj;