{"thread":{"id":"665","subject":"git-diff-tree for the first commit","startedAt":"2005-05-19T19:51:10Z","lastAt":"2005-05-19T20:46:11Z","messageCount":4,"participants":["Thomas Glanzmann","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"3576","messageId":"20050519195110.GG8105@cip.informatik.uni-erlangen.de","threadId":"665","inReplyTo":null,"subject":"git-diff-tree for the first commit","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2005-05-19T19:51:10Z","receivedAt":"2005-05-19T19:51:10Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\nI would like to see output for the first commit (initial import) in:\n\n\tgit-rev-list HEAD | git-diff-tree -r --stdin\n\nis it supposed to just be empty or is that a bug?\n\n\tThomas\n"},{"id":"3579","messageId":"Pine.LNX.4.58.0505191323060.2322@ppc970.osdl.org","threadId":"665","inReplyTo":"20050519195110.GG8105@cip.informatik.uni-erlangen.de","subject":"Re: git-diff-tree for the first commit","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-19T20:31:13Z","receivedAt":"2005-05-19T20:31:13Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 19 May 2005, Thomas Glanzmann wrote:\n>\n> I would like to see output for the first commit (initial import) in:\n> \n> \tgit-rev-list HEAD | git-diff-tree -r --stdin\n> \n> is it supposed to just be empty or is that a bug?\n\nHmm.. That's a bug and/or a feature, entirely depending on how you feel.\n\nThe first commit doesn't have a parent, so in the world where this is a \nfeature, this is 100% consistent with the notion that since there is \nnothing to diff against, diff-tree has nothing to do.\n\nIn an alternate world, you can decide that not having a parent is \nequivalent to being parented with an empty tree.\n\nIn yet a third world, you'd decide that all git projects should start off \nfrom the empty tree root parent, and that the kernel project (and the git \narchive itself) is invalid.\n\nI don't think there is a right answer, except that I think the third\nversion is likely wrong, since by definition the kernel archive is\nperfect.\n\nThere's actually some reason to consider the current behaviour correct, in\nthat the initial tree really _is_ special: it was imported from somewhere\nelse, and as such anybody who wants to know \"what changed\" really doesn't\nwant to see the explosion that happened at the beginning of time: that\nwasn't a \"change\" at all, that was something else.\n\nSo the current behaviour actually is (in my opinion) the right one, at\nleast when considering something like git-whatchanged. Similarly, if you\nuse a variation of git-whatchanged to implement the equivalent of \"cvs\nannotate\", leaving the lines that don't have a diff _non-annotated_ is\nactually the right thing to do, since it would be wrong to say \"they came\nfrom the person who did the initial import\".\n\nThat said, a new flag that says \"diff the root against the NUL tree\" \nwouldn't be wrong either, for when that is what you want.\n\n\t\t\tLinus\n"},{"id":"3582","messageId":"20050519203839.GJ8105@cip.informatik.uni-erlangen.de","threadId":"665","inReplyTo":"Pine.LNX.4.58.0505191323060.2322@ppc970.osdl.org","subject":"Re: git-diff-tree for the first commit","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2005-05-19T20:38:39Z","receivedAt":"2005-05-19T20:38:39Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\nI see. Thanks for the elaboration. I got the idea now. ;-)\n\n> That said, a new flag that says \"diff the root against the NUL tree\" \n> wouldn't be wrong either, for when that is what you want.\n\nI want it for the following scenario:\n\nMy git frontend sets the time stamps of the checked-out files to the\ntime of the last modification. That way I can do a 'ls -lart' in a sub\ndirectory and have the most recently touched files on bottom.  I also\nwant to use this for keyword expansion.\n\nI currently do it by calling more or less 'git-rev-tool HEAD' and\n'git-diff-tree -r REVISION' and cache the output. However for the inital\nimport are no 'timestamps' available. Now I can do two things. Implement\na git-diff-tree flag or assume that any files which don't have a delta\nare imported by the initial tree.\n\n\nIdeas?\n\n\tThomas\n"},{"id":"3583","messageId":"Pine.LNX.4.58.0505191345260.2322@ppc970.osdl.org","threadId":"665","inReplyTo":"Pine.LNX.4.58.0505191323060.2322@ppc970.osdl.org","subject":"Re: git-diff-tree for the first commit","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-19T20:46:11Z","receivedAt":"2005-05-19T20:46:11Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 19 May 2005, Linus Torvalds wrote:\n> \n> That said, a new flag that says \"diff the root against the NUL tree\" \n> wouldn't be wrong either, for when that is what you want.\n\nDone. Use \"git-diff-tree --root\" if you want to see the root commit as a \nbig diff against nothing.\n\n\t\tLinus\n"}]}