{"thread":{"id":"24952","subject":"[PATCH] parse_object: pass on the original sha1, not the replaced one","startedAt":"2010-09-02T21:13:20Z","lastAt":"2010-09-03T04:37:41Z","messageCount":3,"participants":["Christian Couder","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"149721","messageId":"20100902211321.18003.34601.chriscool@tuxfamily.org","threadId":"24952","inReplyTo":null,"subject":"[PATCH] parse_object: pass on the original sha1, not the replaced one","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-09-02T21:13:20Z","receivedAt":"2010-09-02T21:13:20Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= <pclouds@gmail.com>\n\nCommit 0e87c36 (object: call \"check_sha1_signature\" with the\nreplacement sha1) changed the first argument passed to\nparse_object_buffer() from \"sha1\" to \"repl\". With that change,\nthe returned obj pointer has the replacement SHA1 in obj->sha1,\nnot the original one.\n\nBut when using lookup_commit() and then parse_commit() on a\ncommit, we get an object pointer with the original sha1, but\nthe commit content comes from the replacement commit.\n\nSo the result we get from using parse_object() is different\nfrom the we get from using lookup_commit() followed by\nparse_commit().\n\nIt looks much simpler and safer to fix this inconsistency by\npassing \"sha1\" to parse_object_bufer() instead of \"repl\".\n\nThe commit comment should be used to tell the the replacement\ncommit is replacing another commit and why. So it should be\neasy to see that we have a replacement commit instead of an\noriginal one.\n\nAnd it is not a problem if the content of the commit is not\nconsistent with the sha1 as cat-file piped to hash-object can\nbe used to see the difference.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\nSince no one resent the original patch with an improved commit\nmessage, here is my try.\n\n object.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/object.c b/object.c\nindex 277b3dd..7adfda7 100644\n--- a/object.c\n+++ b/object.c\n@@ -199,7 +199,7 @@ struct object *parse_object(const unsigned char *sha1)\n \t\t\treturn NULL;\n \t\t}\n \n-\t\tobj = parse_object_buffer(repl, type, size, buffer, &eaten);\n+\t\tobj = parse_object_buffer(sha1, type, size, buffer, &eaten);\n \t\tif (!eaten)\n \t\t\tfree(buffer);\n \t\treturn obj;\n-- \n1.7.2.2.417.g10a17\n"},{"id":"149736","messageId":"AANLkTikBau2-ggvZa2Zp35gTk_j8JEAY8nyVh3i0-ap7@mail.gmail.com","threadId":"24952","inReplyTo":"20100902211321.18003.34601.chriscool@tuxfamily.org","subject":"Re: [PATCH] parse_object: pass on the original sha1, not the replaced one","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-09-02T23:24:07Z","receivedAt":"2010-09-02T23:24:07Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Sep 3, 2010 at 7:13 AM, Christian Couder\n<chriscool@tuxfamily.org> wrote:\n> Since no one resent the original patch with an improved commit\n> message, here is my try.\n\nMy bad. I forgot something again. I will think of something to\ndemonstrate this. By the way, it breaks t6050.14, bisect and\nreplacements.\n-- \nDuy\n"},{"id":"149748","messageId":"201009030637.41728.chriscool@tuxfamily.org","threadId":"24952","inReplyTo":"AANLkTikBau2-ggvZa2Zp35gTk_j8JEAY8nyVh3i0-ap7@mail.gmail.com","subject":"Re: [PATCH] parse_object: pass on the original sha1, not the replaced one","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-09-03T04:37:41Z","receivedAt":"2010-09-03T04:37:41Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Friday 03 September 2010 01:24:07 Nguyen Thai Ngoc Duy wrote:\n> On Fri, Sep 3, 2010 at 7:13 AM, Christian Couder\n> \n> <chriscool@tuxfamily.org> wrote:\n> > Since no one resent the original patch with an improved commit\n> > message, here is my try.\n> \n> My bad. I forgot something again. I will think of something to\n> demonstrate this. By the way, it breaks t6050.14, bisect and\n> replacements.\n\nOoops, yeah, I will have a look at this.\n\nThanks,\nChristian.\n"}]}