{"thread":{"id":"15448","subject":"Commit 140b378d07229e breaks gitk highlighting","startedAt":"2008-09-09T12:31:19Z","lastAt":"2008-09-10T20:03:35Z","messageCount":4,"participants":["Mark Levedahl","Karl Hasselström","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"90208","messageId":"30e4a070809090531i6c6dd2c8r189e70927b5444c9@mail.gmail.com","threadId":"15448","inReplyTo":null,"subject":"Commit 140b378d07229e breaks gitk highlighting","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-09-09T12:31:19Z","receivedAt":"2008-09-09T12:31:19Z","isPatch":false,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"gitk since the above commit (\"Teach git diff-tree --stdin to diff\ntrees\") fails to reliably highlight commits matching a given path\nspecification. For an example of the problem,\n\n   $gitk ec3a4ba519c001\n\n   and select commit \"touching paths\" with \"t\" in the entry bar\n\nThe 4'th commit down (t9124: clean up chdir usage) is NOT highlighted,\nthough it clearly touches t. Reverting commit 140b378 restores the\ncorrect behavior. This gets into parts of the code I don't understand,\nso I decline to try to offer a patch.\n\nMark\n"},{"id":"90364","messageId":"20080910160112.GC26098@diana.vm.bytemark.co.uk","threadId":"15448","inReplyTo":"30e4a070809090531i6c6dd2c8r189e70927b5444c9@mail.gmail.com","subject":"Re: Commit 140b378d07229e breaks gitk highlighting","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-09-10T16:01:12Z","receivedAt":"2008-09-10T16:01:12Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-09-09 08:31:19 -0400, Mark Levedahl wrote:\n\n> gitk since the above commit (\"Teach git diff-tree --stdin to diff\n> trees\") fails to reliably highlight commits matching a given path\n> specification.\n\nHmmm, not good. Any idea of what git commands gitk actually runs in\nyour example? Would be nice to be able to diff the output before and\nafter the change.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"90379","messageId":"7vtzcnx0uc.fsf@gitster.siamese.dyndns.org","threadId":"15448","inReplyTo":"30e4a070809090531i6c6dd2c8r189e70927b5444c9@mail.gmail.com","subject":"Re: Commit 140b378d07229e breaks gitk highlighting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-10T19:22:35Z","receivedAt":"2008-09-10T19:22:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Mark Levedahl\" <mlevedahl@gmail.com> writes:\n\n> gitk since the above commit (\"Teach git diff-tree --stdin to diff\n> trees\") fails to reliably highlight commits matching a given path\n> specification. For an example of the problem,\n>\n>    $gitk ec3a4ba519c001\n>\n>    and select commit \"touching paths\" with \"t\" in the entry bar\n>\n> The 4'th commit down (t9124: clean up chdir usage) is NOT highlighted,\n> though it clearly touches t. Reverting commit 140b378 restores the\n> correct behavior. This gets into parts of the code I don't understand,\n> so I decline to try to offer a patch.\n\nFeeding the following to \"git diff-tree -r -s --stdin -- t\" misbehaves\nwith that change.  The second line is skipped.\n\n7c4d0219cf9ab6a7738a09ad7fec72d5e9f2ac67\na786091b4a487bc08bbff4864717cf5d8383e983\n4a09bc966449ca0a7e9a5bb70f91b47debdd7c4e\n\nThis should fix it.\n\nI think we should have a stronger warning against misusing lookup_object()\nwithout knowing what it does.  It is marked \"Internal only\" in the header,\nbut it does not explain why.  The interface is there to help the lazy\nobject lookup (e.g. you parse a commit and learn about a parent it has.\nYou do not want to read the parent commit at that point, so you create a\nplaceholder commit object and point at it from the child.  You would want\nto make sure that you populate the same placeholder object with the data\nyou read from the parent commit when it gets the turn of the parent commit\nto be parsed).\n\ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex 1138c2d..a9e32c9 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -71,8 +71,7 @@ static int diff_tree_stdin(char *line)\n \tline[len-1] = 0;\n \tif (get_sha1_hex(line, sha1))\n \t\treturn -1;\n-\tobj = lookup_object(sha1);\n-\tobj = obj ? obj : parse_object(sha1);\n+\tobj = parse_object(sha1);\n \tif (!obj)\n \t\treturn -1;\n \tif (obj->type == OBJ_COMMIT)\n"},{"id":"90380","messageId":"30e4a070809101303u15b98bd5uc11f545fdb5a8835@mail.gmail.com","threadId":"15448","inReplyTo":"7vtzcnx0uc.fsf@gitster.siamese.dyndns.org","subject":"Re: Commit 140b378d07229e breaks gitk highlighting","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-09-10T20:03:35Z","receivedAt":"2008-09-10T20:03:35Z","isPatch":false,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"On Wed, Sep 10, 2008 at 3:22 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Feeding the following to \"git diff-tree -r -s --stdin -- t\" misbehaves\n> with that change.  The second line is skipped.\n>\n> 7c4d0219cf9ab6a7738a09ad7fec72d5e9f2ac67\n> a786091b4a487bc08bbff4864717cf5d8383e983\n> 4a09bc966449ca0a7e9a5bb70f91b47debdd7c4e\n>\n> This should fix it.\n>\n\n> diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\n> index 1138c2d..a9e32c9 100644\n> --- a/builtin-diff-tree.c\n> +++ b/builtin-diff-tree.c\n> @@ -71,8 +71,7 @@ static int diff_tree_stdin(char *line)\n>        line[len-1] = 0;\n>        if (get_sha1_hex(line, sha1))\n>                return -1;\n> -       obj = lookup_object(sha1);\n> -       obj = obj ? obj : parse_object(sha1);\n> +       obj = parse_object(sha1);\n>        if (!obj)\n>                return -1;\n>        if (obj->type == OBJ_COMMIT)\n>\n\nYes, that fixes the problems I see.\n\nThanks,\nMark\n"}]}