{"thread":{"id":"50082","subject":"Incorrect tree shown with ls-tree ref^{type}:{{folder}}","startedAt":"2018-12-20T20:05:30Z","lastAt":"2018-12-20T20:05:30Z","messageCount":1,"participants":["Stan Hu"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"365699","messageId":"CAMBWrQ=nWQpyp3JPkBAzmZUioUTThUC9y9=xiHCtUTvA9m2yUA@mail.gmail.com","threadId":"50082","inReplyTo":null,"subject":"Incorrect tree shown with ls-tree ref^{type}:{{folder}}","fromName":"Stan Hu","fromEmail":"stanhu@gmail.com","sentAt":"2018-12-20T20:05:15Z","receivedAt":"2018-12-20T20:05:30Z","isPatch":false,"sender":{"key":"stanhu@gmail.com","avatar":"https://avatars.githubusercontent.com/u/963826?v=4"},"body":"Suppose I have a repository that has the following files:\n\nfoo/bar/test1.txt\nfoo/{{curly}}/test2.txt\n\nThe following works fine:\n\n$ git ls-tree master^{tree}\n040000 tree 9284ac5fef7ad99a2bd508a8c89bde8bd1a88e9f    foo\n\n$ git ls-tree master^{tree}:foo\n040000 tree 69497de4d9a72713f87df8280a147e0a597c4055    bar\n040000 tree b2abdac384f111c1a8a518e05b963a3bb2541659    {{curly}}\n\n$ git ls-tree master^{tree}:foo/bar\n100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    test1.txt\n\n$ git ls-tree master:foo/{{curly}}\n100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    test2.txt\n\nHowever, the following returns the root tree instead of the tree\nbelonging to {{curly}}:\n\n$ git ls-tree master^{tree}:foo/{{curly}}\n040000 tree 9284ac5fef7ad99a2bd508a8c89bde8bd1a88e9f    foo\n\nI believe the problem is on this line in sha1-name.c:peel_onion()\n(https://github.com/git/git/blob/b21ebb671bb7dea8d342225f0d66c41f4e54d5ca/sha1-name.c#L1004):\n\nif (len < 4 || name[len-1] != '}')\n\nSince name is \"master^{tree}:foo/{{curly}}\", peel_onion() returns\nearly, thinking it is done.\n\nI can append a '/' to force peel_onion() to work, but is that the\nright thing to do here? Should this condition handle the\n\"ref^{type}:filename\" case properly?\n"}]}