{"thread":{"id":"20346","subject":"git show on bare repository?","startedAt":"2009-08-02T03:51:45Z","lastAt":"2009-08-02T06:08:15Z","messageCount":3,"participants":["skillzero@gmail.com","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"119369","messageId":"2729632a0908012051i28654bb7m418ff2ed00138815@mail.gmail.com","threadId":"20346","inReplyTo":null,"subject":"git show on bare repository?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2009-08-02T03:51:45Z","receivedAt":"2009-08-02T03:51:45Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"I could have sworn I used to be able to use git show to display the\ncontents of a file from the server, but now it always says this (if I\nuse -- then it doesn't show anything):\n\nfatal: ambiguous argument 'master:file.txt': unknown revision or path\nnot in the working tree.\nUse '--' to separate paths from revisions\n\nWhat I'm trying to do is allow people to get a single file without\nhaving to clone the entirely repository, like this:\n\nssh git.example.com \"cd /MyRepo.git && git show master:File.txt\"\n\nIf I do this with a non-bare repository, it works. The server is\nrunning git version 1.6.3.2 (I'm running 1.6.4 locally where it\nworks).\n"},{"id":"119370","messageId":"20090802044402.GA21369@coredump.intra.peff.net","threadId":"20346","inReplyTo":"2729632a0908012051i28654bb7m418ff2ed00138815@mail.gmail.com","subject":"Re: git show on bare repository?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-02T04:44:03Z","receivedAt":"2009-08-02T04:44:03Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Aug 01, 2009 at 08:51:45PM -0700, skillzero@gmail.com wrote:\n\n> I could have sworn I used to be able to use git show to display the\n> contents of a file from the server, but now it always says this (if I\n> use -- then it doesn't show anything):\n\nIt should work fine.\n\n> fatal: ambiguous argument 'master:file.txt': unknown revision or path\n> not in the working tree.\n> Use '--' to separate paths from revisions\n\nEither you don't have a 'master' ref, or the commit there doesn't have\n'file.txt'. Try \"git show master\" and \"git show master^{tree}\" to see\nwhich.\n\nIt would be nice if the error were more descriptive (\"master resolved,\nbut does not contain file.txt\"). The vagueness is an artifact of the way\nthe code is structured, I think (we try a lot of different things and\nthen barf at the toplevel, which doesn't know any of the details of how\nfar we got into each possibility).\n\n> What I'm trying to do is allow people to get a single file without\n> having to clone the entirely repository, like this:\n> \n> ssh git.example.com \"cd /MyRepo.git && git show master:File.txt\"\n\nI don't know if this is a cut and past error, but you say \"File\" here\nand \"file\" above. That could cause the error you are seeing.\n\n> If I do this with a non-bare repository, it works. The server is\n> running git version 1.6.3.2 (I'm running 1.6.4 locally where it\n> works).\n\nThe bareness of the repo shouldn't matter, as the filename is coming\nfrom the tree pointed to by 'master'. Unless it is a bug, it is probably\njust that the refs are different between the two repos.\n\n-Peff\n"},{"id":"119375","messageId":"2729632a0908012308t48623e42nc1222d9c2afd2fc8@mail.gmail.com","threadId":"20346","inReplyTo":"20090802044402.GA21369@coredump.intra.peff.net","subject":"Re: git show on bare repository?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2009-08-02T06:08:15Z","receivedAt":"2009-08-02T06:08:15Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"On Sat, Aug 1, 2009 at 9:44 PM, Jeff King<peff@peff.net> wrote:\n> Either you don't have a 'master' ref, or the commit there doesn't have\n> 'file.txt'. Try \"git show master\" and \"git show master^{tree}\" to see\n> which.\n\nIt turns out the file just didn't exist because the repository is at a\nslight different path.\n\nThanks for the help. I didn't know about the ^{tree} thing.\n"}]}