{"thread":{"id":"17117","subject":"[RFC/PATCH 5/7] object: call \"check_sha1_signature\" with the replacement sha1","startedAt":"2009-01-12T17:51:11Z","lastAt":"2009-01-12T17:51:11Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"100146","messageId":"20090112185111.c889feef.chriscool@tuxfamily.org","threadId":"17117","inReplyTo":null,"subject":"[RFC/PATCH 5/7] object: call \"check_sha1_signature\" with the replacement sha1","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-01-12T17:51:11Z","receivedAt":"2009-01-12T17:51:11Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Otherwise we get a \"sha1 mismatch\" error for replaced objects.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n object.c |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/object.c b/object.c\nindex 50b6528..217bee9 100644\n--- a/object.c\n+++ b/object.c\n@@ -187,17 +187,18 @@ struct object *parse_object(const unsigned char *sha1)\n \tunsigned long size;\n \tenum object_type type;\n \tint eaten;\n-\tvoid *buffer = read_sha1_file(sha1, &type, &size);\n+\tconst unsigned char *repl;\n+\tvoid *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);\n \n \tif (buffer) {\n \t\tstruct object *obj;\n-\t\tif (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {\n+\t\tif (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {\n \t\t\tfree(buffer);\n-\t\t\terror(\"sha1 mismatch %s\\n\", sha1_to_hex(sha1));\n+\t\t\terror(\"sha1 mismatch %s\\n\", sha1_to_hex(repl));\n \t\t\treturn NULL;\n \t\t}\n \n-\t\tobj = parse_object_buffer(sha1, type, size, buffer, &eaten);\n+\t\tobj = parse_object_buffer(repl, type, size, buffer, &eaten);\n \t\tif (!eaten)\n \t\t\tfree(buffer);\n \t\treturn obj;\n-- \n1.6.1.83.g16e5\n"}]}