Skip to content

Commit 0e87c36

Browse files
chriscoolgitster
authored andcommitted
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>
1 parent f5552ae commit 0e87c36

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

object.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,18 @@ struct object *parse_object(const unsigned char *sha1)
188188
unsigned long size;
189189
enum object_type type;
190190
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);
192193

193194
if (buffer) {
194195
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) {
196197
free(buffer);
197-
error("sha1 mismatch %s\n", sha1_to_hex(sha1));
198+
error("sha1 mismatch %s\n", sha1_to_hex(repl));
198199
return NULL;
199200
}
200201

201-
obj = parse_object_buffer(sha1, type, size, buffer, &eaten);
202+
obj = parse_object_buffer(repl, type, size, buffer, &eaten);
202203
if (!eaten)
203204
free(buffer);
204205
return obj;

0 commit comments

Comments
 (0)