{"thread":{"id":"25233","subject":"'git diff' against files outside a git repo","startedAt":"2010-09-24T22:23:52Z","lastAt":"2010-09-27T07:38:37Z","messageCount":7,"participants":["Avery Pennarun","Elijah Newren","Brandon Casey","Junio C Hamano","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151579","messageId":"AANLkTinR7BJpD-FOS_DShg=r0ucF2C9oE6p-YoZU-5En@mail.gmail.com","threadId":"25233","inReplyTo":null,"subject":"'git diff' against files outside a git repo","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-09-24T22:23:52Z","receivedAt":"2010-09-24T22:23:52Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"Hi all,\n\nI'm interested in using 'git diff' on some files that aren't actually\ninside a git repo at all.  Specifically, the --color-words and\n--word-diff-regex are really cool and I happen to have a use for them\non files that aren't stored verbatim in git.  As a whole, git's\nimplementation of diff seems to be the fastest-moving one out there,\nso I'd rather use it instead of another random diff implementation.\n\n(For the curious: the particular \"files\" I want to compare are\nactually split into a hierarchical tree of blobs using bup's rolling\nchecksum and *then* stored in git.  Obviously I have to reassemble\nthem before I can diff them, which is fine and easy, but I then want\nto run 'git diff' against them, which seems to not be so easy.)\n\n(For the extremely curious: the particular files I want to diff are\nmega-gigantic csv files from database dumps.  Because of bup's tree\nformat, I should be able to zoom in on just the overall part of the\nfile that has changed, then diff only that, which will be much faster\nthan running a diff algorithm against the whole file.  Essentially\nO(log n) vs. the file size.)\n\nIs there already a way to get 'git diff' to do this?\n\nIf not, would it be sensible to extend git-diff to do comparison\nbetween two outside files?\n\nOr should I stop trying to do this and use some other diff\nimplementation instead?\n\nAnother alternative would be to teach git directly how to act on\nbup-style large objects, but that's... a lot of work.  And it's not\nobvious that a patch to do so would be accepted anyhow, since\nbup-style storage is necessarily not as space-efficient and is harder\nto deltify.\n\nThanks,\n\nAvery\n"},{"id":"151580","messageId":"AANLkTik4kL8Mao1VM=njNxFSXOY7guwuEZgmpv0UTc8R@mail.gmail.com","threadId":"25233","inReplyTo":"AANLkTinR7BJpD-FOS_DShg=r0ucF2C9oE6p-YoZU-5En@mail.gmail.com","subject":"Re: 'git diff' against files outside a git repo","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2010-09-24T22:30:19Z","receivedAt":"2010-09-24T22:30:19Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Sep 24, 2010 at 4:23 PM, Avery Pennarun <apenwarr@gmail.com> wrote:\n> Hi all,\n>\n> I'm interested in using 'git diff' on some files that aren't actually\n> inside a git repo at all.  Specifically, the --color-words and\n> --word-diff-regex are really cool and I happen to have a use for them\n> on files that aren't stored verbatim in git.  As a whole, git's\n> implementation of diff seems to be the fastest-moving one out there,\n> so I'd rather use it instead of another random diff implementation.\n>\n<snip>\n> Is there already a way to get 'git diff' to do this?\n>\n> If not, would it be sensible to extend git-diff to do comparison\n> between two outside files?\n\nIsn't this what git diff --no-index ... does?\n"},{"id":"151581","messageId":"-30AUOVW2mMJiL1EZcTFG9LhiQWZDLcLpaLzWQHRY8tnzFEGXuZLuw@cipher.nrlssc.navy.mil","threadId":"25233","inReplyTo":"AANLkTinR7BJpD-FOS_DShg=r0ucF2C9oE6p-YoZU-5En@mail.gmail.com","subject":"Re: 'git diff' against files outside a git repo","fromName":"Brandon Casey","fromEmail":"brandon.casey.ctr@nrlssc.navy.mil","sentAt":"2010-09-24T22:30:42Z","receivedAt":"2010-09-24T22:30:42Z","isPatch":false,"sender":{"key":"brandon.casey.ctr@nrlssc.navy.mil","avatar":null},"body":"On 09/24/2010 05:23 PM, Avery Pennarun wrote:\n> Hi all,\n> \n> I'm interested in using 'git diff' on some files that aren't actually\n> inside a git repo at all.  Specifically, the --color-words and\n> --word-diff-regex are really cool and I happen to have a use for them\n> on files that aren't stored verbatim in git.  As a whole, git's\n> implementation of diff seems to be the fastest-moving one out there,\n> so I'd rather use it instead of another random diff implementation.\n> \n> (For the curious: the particular \"files\" I want to compare are\n> actually split into a hierarchical tree of blobs using bup's rolling\n> checksum and *then* stored in git.  Obviously I have to reassemble\n> them before I can diff them, which is fine and easy, but I then want\n> to run 'git diff' against them, which seems to not be so easy.)\n> \n> (For the extremely curious: the particular files I want to diff are\n> mega-gigantic csv files from database dumps.  Because of bup's tree\n> format, I should be able to zoom in on just the overall part of the\n> file that has changed, then diff only that, which will be much faster\n> than running a diff algorithm against the whole file.  Essentially\n> O(log n) vs. the file size.)\n> \n> Is there already a way to get 'git diff' to do this?\n\nDoesn't\n\n   git diff file.one file.two\n\nwork?\n\nOr are you asking for something else?\n\n-Brandon\n"},{"id":"151619","messageId":"AANLkTikpPQM4GyP5O7+aw6_P9_1DdxUjTzpH=WhzW=wK@mail.gmail.com","threadId":"25233","inReplyTo":"AANLkTik4kL8Mao1VM=njNxFSXOY7guwuEZgmpv0UTc8R@mail.gmail.com","subject":"Re: 'git diff' against files outside a git repo","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-09-25T07:45:10Z","receivedAt":"2010-09-25T07:45:10Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Sep 24, 2010 at 3:30 PM, Elijah Newren <newren@gmail.com> wrote:\n> On Fri, Sep 24, 2010 at 4:23 PM, Avery Pennarun <apenwarr@gmail.com> wrote:\n>> I'm interested in using 'git diff' on some files that aren't actually\n>> inside a git repo at all.  Specifically, the --color-words and\n>> --word-diff-regex are really cool and I happen to have a use for them\n>> on files that aren't stored verbatim in git.  As a whole, git's\n>> implementation of diff seems to be the fastest-moving one out there,\n>> so I'd rather use it instead of another random diff implementation.\n>>\n> <snip>\n>> Is there already a way to get 'git diff' to do this?\n>>\n>> If not, would it be sensible to extend git-diff to do comparison\n>> between two outside files?\n>\n> Isn't this what git diff --no-index ... does?\n\nAha, that was exactly what I wanted. :)\n\nOddly, 'git diff file1 file2' *doesn't* work when file1 and file2 are\nin a working tree; git tries to diff something, apparently, but I\ndon't know what.  When you're outside a working tree, it works.  And\nyour \"--no-index\" suggestion is what makes it work even when you're in\na working tree.\n\nThanks to you and Brandon for your help.  I guess I'll try to submit a\npatch to the git-diff manpage to make this type of usage more obvious.\n\nHave fun,\n\nAvery\n"},{"id":"151704","messageId":"7vwrq9m0y0.fsf@alter.siamese.dyndns.org","threadId":"25233","inReplyTo":"AANLkTikpPQM4GyP5O7+aw6_P9_1DdxUjTzpH=WhzW=wK@mail.gmail.com","subject":"Re: 'git diff' against files outside a git repo","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-26T07:13:59Z","receivedAt":"2010-09-26T07:13:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Avery Pennarun <apenwarr@gmail.com> writes:\n\n> Oddly, 'git diff file1 file2' *doesn't* work when file1 and file2 are\n> in a working tree; git tries to diff something, apparently, but I\n> don't know what.\n\nHeh, I thought you've been using git long enough that you sh/would know\nthat you are comparing the index and the working tree, using \"file1\" and\n\"file2\" as pathspecs.\n"},{"id":"151705","messageId":"AANLkTikJ-SN5xmwqhEHcESfQCWvGjSHp3OK1Hi4+0jBL@mail.gmail.com","threadId":"25233","inReplyTo":"7vwrq9m0y0.fsf@alter.siamese.dyndns.org","subject":"Re: 'git diff' against files outside a git repo","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-09-26T09:38:21Z","receivedAt":"2010-09-26T09:38:21Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Sun, Sep 26, 2010 at 12:13 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Avery Pennarun <apenwarr@gmail.com> writes:\n>\n>> Oddly, 'git diff file1 file2' *doesn't* work when file1 and file2 are\n>> in a working tree; git tries to diff something, apparently, but I\n>> don't know what.\n>\n> Heh, I thought you've been using git long enough that you sh/would know\n> that you are comparing the index and the working tree, using \"file1\" and\n> \"file2\" as pathspecs.\n\nHa, of course.  And I do that all the time, so it's silly that I\nsomehow forgot for the duration of that email.\n\nThe real surprise was that this *wasn't* the meaning when I was\noutside a git tree :)\n\nHave fun,\n\nAvery\n"},{"id":"151803","messageId":"4CA049FD.5040100@drmicha.warpmail.net","threadId":"25233","inReplyTo":"AANLkTikJ-SN5xmwqhEHcESfQCWvGjSHp3OK1Hi4+0jBL@mail.gmail.com","subject":"Re: 'git diff' against files outside a git repo","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-09-27T07:38:37Z","receivedAt":"2010-09-27T07:38:37Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Avery Pennarun venit, vidit, dixit 26.09.2010 11:38:\n> On Sun, Sep 26, 2010 at 12:13 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Avery Pennarun <apenwarr@gmail.com> writes:\n>>\n>>> Oddly, 'git diff file1 file2' *doesn't* work when file1 and file2 are\n>>> in a working tree; git tries to diff something, apparently, but I\n>>> don't know what.\n>>\n>> Heh, I thought you've been using git long enough that you sh/would know\n>> that you are comparing the index and the working tree, using \"file1\" and\n>> \"file2\" as pathspecs.\n> \n> Ha, of course.  And I do that all the time, so it's silly that I\n> somehow forgot for the duration of that email.\n> \n> The real surprise was that this *wasn't* the meaning when I was\n> outside a git tree :)\n\nWell, DWIM really is DWYTIM ;)\n\nMichael\n"}]}