Skip to content

Commit

Permalink
object: call "check_sha1_signature" with the replacement sha1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Jun 1, 2009
1 parent f5552ae commit 0e87c36
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,18 @@ struct object *parse_object(const unsigned char *sha1)
unsigned long size;
enum object_type type;
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) {
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);
error("sha1 mismatch %s\n", sha1_to_hex(sha1));
error("sha1 mismatch %s\n", sha1_to_hex(repl));
return NULL;
}

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

0 comments on commit 0e87c36

Please sign in to comment.