{"thread":{"id":"24759","subject":"[RFC/PATCH 2/2] blame: fix output in case of replacement by using parse_commit_repl()","startedAt":"2010-08-17T01:59:00Z","lastAt":"2010-08-17T06:16:18Z","messageCount":3,"participants":["Christian Couder","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"148212","messageId":"20100817015901.5592.419.chriscool@tuxfamily.org","threadId":"24759","inReplyTo":null,"subject":"[RFC/PATCH 2/2] blame: fix output in case of replacement by using parse_commit_repl()","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-08-17T01:59:00Z","receivedAt":"2010-08-17T01:59:00Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"git blame was not showing the sha1 of the replacement commit while\nit was properly showing other information from the replacement commit,\nbecause parse_commit() is buggy regarding replacement.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin/blame.c    |    4 ++--\n t/t6050-replace.sh |    8 ++++++++\n 2 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 8f9e7b0..c469e09 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1226,7 +1226,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)\n \n \t\t\tif (sg_origin[i])\n \t\t\t\tcontinue;\n-\t\t\tif (parse_commit(p))\n+\t\t\tif (parse_commit_repl(&p))\n \t\t\t\tcontinue;\n \t\t\tporigin = find(sb, p, origin);\n \t\t\tif (!porigin)\n@@ -1558,7 +1558,7 @@ static void assign_blame(struct scoreboard *sb, int opt)\n \t\torigin_incref(suspect);\n \t\tcommit = suspect->commit;\n \t\tif (!commit->object.parsed)\n-\t\t\tparse_commit(commit);\n+\t\t\tparse_commit_repl(&commit);\n \t\tif (reverse ||\n \t\t    (!(commit->object.flags & UNINTERESTING) &&\n \t\t     !(revs->max_age != -1 && commit->date < revs->max_age)))\ndiff --git a/t/t6050-replace.sh b/t/t6050-replace.sh\nindex 4185b7c..881a2e8 100755\n--- a/t/t6050-replace.sh\n+++ b/t/t6050-replace.sh\n@@ -225,6 +225,14 @@ test_expect_success 'index-pack and replacements' '\n \tgit index-pack test-*.pack\n '\n \n+test_expect_success 'blame and replacements' '\n+\tgit blame hello > blame.txt &&\n+\tgrep \"$(git rev-parse --short $S)\" blame.txt > lines.txt &&\n+\tgrep \"O Thor\" lines.txt &&\n+\tgrep \"line 9\" lines.txt &&\n+\tgrep \"line 10\" lines.txt\n+'\n+\n #\n #\n test_done\n-- \n1.7.2.1.351.g275bf\n"},{"id":"148220","messageId":"AANLkTimMXmi1ZhVYXtbMz3doOUZMzbRggqcUY0L7wKyY@mail.gmail.com","threadId":"24759","inReplyTo":"20100817015901.5592.419.chriscool@tuxfamily.org","subject":"Re: [RFC/PATCH 2/2] blame: fix output in case of replacement by using parse_commit_repl()","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-17T03:44:11Z","receivedAt":"2010-08-17T03:44:11Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Aug 17, 2010 at 11:59 AM, Christian Couder\n<chriscool@tuxfamily.org> wrote:\n> git blame was not showing the sha1 of the replacement commit while\n> it was properly showing other information from the replacement commit,\n> because parse_commit() is buggy regarding replacement.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  builtin/blame.c    |    4 ++--\n>  t/t6050-replace.sh |    8 ++++++++\n>  2 files changed, 10 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/blame.c b/builtin/blame.c\n> index 8f9e7b0..c469e09 100644\n> --- a/builtin/blame.c\n> +++ b/builtin/blame.c\n> @@ -1226,7 +1226,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)\n>\n>                        if (sg_origin[i])\n>                                continue;\n> -                       if (parse_commit(p))\n> +                       if (parse_commit_repl(&p))\n\nThis is the hard way. There are another ~40 parse_commit() calls\nelsewhere. Most of them are in git commands, so we can check one by\none. There are some calls in revision.c, sha1_name.c, tree.c,\nupload-pack.c and walker.c, which may be used in many places. Checking\nthem would be harder.\n-- \nDuy\n"},{"id":"148230","messageId":"201008170816.18600.chriscool@tuxfamily.org","threadId":"24759","inReplyTo":"AANLkTimMXmi1ZhVYXtbMz3doOUZMzbRggqcUY0L7wKyY@mail.gmail.com","subject":"Re: [RFC/PATCH 2/2] blame: fix output in case of replacement by using parse_commit_repl()","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-08-17T06:16:18Z","receivedAt":"2010-08-17T06:16:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tuesday 17 August 2010 05:44:11 Nguyen Thai Ngoc Duy wrote:\n> On Tue, Aug 17, 2010 at 11:59 AM, Christian Couder\n> \n> <chriscool@tuxfamily.org> wrote:\n> > git blame was not showing the sha1 of the replacement commit while\n> > it was properly showing other information from the replacement commit,\n> > because parse_commit() is buggy regarding replacement.\n> > \n> > Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> > ---\n> >  builtin/blame.c    |    4 ++--\n> >  t/t6050-replace.sh |    8 ++++++++\n> >  2 files changed, 10 insertions(+), 2 deletions(-)\n> > \n> > diff --git a/builtin/blame.c b/builtin/blame.c\n> > index 8f9e7b0..c469e09 100644\n> > --- a/builtin/blame.c\n> > +++ b/builtin/blame.c\n> > @@ -1226,7 +1226,7 @@ static void pass_blame(struct scoreboard *sb,\n> > struct origin *origin, int opt)\n> > \n> >                        if (sg_origin[i])\n> >                                continue;\n> > -                       if (parse_commit(p))\n> > +                       if (parse_commit_repl(&p))\n> \n> This is the hard way. There are another ~40 parse_commit() calls\n> elsewhere. Most of them are in git commands, so we can check one by\n> one. There are some calls in revision.c, sha1_name.c, tree.c,\n> upload-pack.c and walker.c, which may be used in many places. Checking\n> them would be harder.\n\nYeah, I will try to provide test cases but it may not be possible in some \ncases.\n\nBest regards,\nChristian.\n"}]}