Browse Source

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>
maint
Christian Couder 16 years ago committed by Junio C Hamano
parent
commit
0e87c36763
  1. 9
      object.c

9
object.c

@ -188,17 +188,18 @@ struct object *parse_object(const unsigned char *sha1)
unsigned long size; unsigned long size;
enum object_type type; enum object_type type;
int eaten; int eaten;
void *buffer = read_sha1_file(sha1, &type, &size); const unsigned char *repl;
void *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);


if (buffer) { if (buffer) {
struct object *obj; struct object *obj;
if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) { if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
free(buffer); free(buffer);
error("sha1 mismatch %s\n", sha1_to_hex(sha1)); error("sha1 mismatch %s\n", sha1_to_hex(repl));
return NULL; return NULL;
} }


obj = parse_object_buffer(sha1, type, size, buffer, &eaten); obj = parse_object_buffer(repl, type, size, buffer, &eaten);
if (!eaten) if (!eaten)
free(buffer); free(buffer);
return obj; return obj;

Loading…
Cancel
Save