{"thread":{"id":"25295","subject":"wierd git show syntax","startedAt":"2010-09-30T05:02:48Z","lastAt":"2010-10-04T22:32:12Z","messageCount":5,"participants":["Geoff Russell","Tomas Carnecky","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"152114","messageId":"AANLkTi=Zz-1dSC0imJ3NZXWcdvhXWXt-Kk94zwKe8+6Y@mail.gmail.com","threadId":"25295","inReplyTo":null,"subject":"wierd git show syntax","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2010-09-30T05:02:48Z","receivedAt":"2010-09-30T05:02:48Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"Hi,\n\n$ git show XXXX:data/path/object.c\n\nGives me what I want, a cat of the objects contents. However\nfor some files I get a message about ambiguous argument telling me to\nseparate paths from revisions with '--'. Okay so I try that:\n\n$ git show -- XXXX:data/path/object.c\n\nBut it gives me nothing\n\n$ git show XXXX -- data/path/object.c\n\nGives me a git diff output for the object.\n\n\nThis is all with git 1.6.2.3\n\nWhat's happening here? Why aren't all these equivalent?\n\n\nCheers,\nGeoff Russell\n"},{"id":"152118","messageId":"4CA44E7D.7090901@dbservice.com","threadId":"25295","inReplyTo":"AANLkTi=Zz-1dSC0imJ3NZXWcdvhXWXt-Kk94zwKe8+6Y@mail.gmail.com","subject":"Re: wierd git show syntax","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2010-09-30T08:46:53Z","receivedAt":"2010-09-30T08:46:53Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"On 9/30/10 7:02 AM, Geoff Russell wrote:\n> Hi,\n> \n> $ git show XXXX:data/path/object.c\n\nShow me the contents of the file at data/path/object.c in revision XXXX.\n\n> Gives me what I want, a cat of the objects contents. However\n> for some files I get a message about ambiguous argument telling me to\n> separate paths from revisions with '--'. Okay so I try that:\n> \n> $ git show -- XXXX:data/path/object.c\n\nShow me the commit HEAD but limit the diff to the path\nXXXX:data/path/object.c.\n\nThere is an implicit HEAD before the double dash. You probably want the\ndouble dash *after* the object, to force git to parse that string as an\nobject and not a path:\n\n$ git show XXXX:data/path/object.c --\n\n> But it gives me nothing\n> \n> $ git show XXXX -- data/path/object.c\n\nShow me the commit XXXX but limit the diff to the path data/path/object.c.\n\n> Gives me a git diff output for the object.\n> \n> \n> This is all with git 1.6.2.3\n> \n> What's happening here? Why aren't all these equivalent?\n\nno.\n\ntom\n"},{"id":"152119","messageId":"4CA4520F.30809@dbservice.com","threadId":"25295","inReplyTo":"4CA44E7D.7090901@dbservice.com","subject":"Re: wierd git show syntax","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2010-09-30T09:02:07Z","receivedAt":"2010-09-30T09:02:07Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"On 9/30/10 10:46 AM, Tomas Carnecky wrote:\n>> What's happening here? Why aren't all these equivalent?\n> \n> no.\n\nA 'no' does not really fit a 'why?' question. I should explain.\n\nSomeone (Linus?) long ago decided that the revision parsing work that\nway. It's pretty powerful, even the smallest colon and double dash have\na meaning. But it can be complicated for someone new to git to\nunderstand. See 'man gitrevisions' to understand how git parses\nrevisions. Sadly the effect of double bash is not described in the\ngit-show man page. But in most commands it's used to separate revisions\nfrom paths. Example: if you have a file and branch both named master,\n'git log master --' will show you the log of that branch while 'git log\n-- master' will show you the log of HEAD but limit it to commits which\ntouched the file master. Again, there's an implicit HEAD before the\ndouble dash.\n\ntom\n"},{"id":"152125","messageId":"vpqtyl7fovk.fsf@bauges.imag.fr","threadId":"25295","inReplyTo":"AANLkTi=Zz-1dSC0imJ3NZXWcdvhXWXt-Kk94zwKe8+6Y@mail.gmail.com","subject":"Re: wierd git show syntax","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-09-30T11:32:31Z","receivedAt":"2010-09-30T11:32:31Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Geoff Russell <geoffrey.russell@gmail.com> writes:\n\n> Hi,\n>\n> $ git show XXXX:data/path/object.c\n>\n> Gives me what I want, a cat of the objects contents. However\n> for some files I get a message about ambiguous argument telling me to\n> separate paths from revisions with '--'.\n\nThis happens if data/path/object.c doesn't exist in XXXX.\n\nA common mistake is to write XXXX:relative/path when Git expects a\npath relative to the tree root. Git >= 1.7 would give you a more\nfriendly error message in this case.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"152612","messageId":"AANLkTineQDgVUvbjR-9LvtuVVw3RX_gB=urY5Fn4K6QE@mail.gmail.com","threadId":"25295","inReplyTo":"vpqtyl7fovk.fsf@bauges.imag.fr","subject":"Re: wierd git show syntax","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2010-10-04T22:32:12Z","receivedAt":"2010-10-04T22:32:12Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"On Thu, Sep 30, 2010 at 10:02 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Geoff Russell <geoffrey.russell@gmail.com> writes:\n>\n>> Hi,\n>>\n>> $ git show XXXX:data/path/object.c\n>>\n>> Gives me what I want, a cat of the objects contents. However\n>> for some files I get a message about ambiguous argument telling me to\n>> separate paths from revisions with '--'.\n>\n> This happens if data/path/object.c doesn't exist in XXXX.\n\nThanks Matthieu and Tom for your explanations on this. It's clearer\nnow ... even if my intuition failed to match the syntax!\n\nCheers,\nGeoff\n"}]}