{"thread":{"id":"25586","subject":"git diff-tree against the root commit","startedAt":"2010-10-29T06:13:55Z","lastAt":"2010-11-07T17:23:25Z","messageCount":3,"participants":["Joshua Jensen","Christoph Mallon","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"154718","messageId":"4CCA6623.8090705@workspacewhiz.com","threadId":"25586","inReplyTo":null,"subject":"git diff-tree against the root commit","fromName":"Joshua Jensen","fromEmail":"jjensen@workspacewhiz.com","sentAt":"2010-10-29T06:13:55Z","receivedAt":"2010-10-29T06:13:55Z","isPatch":false,"sender":{"key":"jjensen@workspacewhiz.com","avatar":"https://avatars.githubusercontent.com/u/111687?v=4"},"body":"I am mirroring a Git repository into another SCM.  I am using 'git \ndiff-tree' to tell me what changes I need to make to the other SCM.\n\nToday, I attempted to mirror a new submodule.  'git diff-tree' reported \ntwo SHAs... 0000000000000000000000000000000000000000 and the revision \nthe submodule currently resides at.  I attempted to run a 'git \ndiff-tree' within the submodule for the all zero SHA and the revision \nspecified, but apparently, 0000000000000000000000000000000000000000 does \nnot really represent the root commit and does not work.  I then \ndiscovered the --root option, but that doesn't seem to give me the \ncomplete file list either.\n\n'git diff-tree' has been working great for everything else, but I really \nneed a root commit diff-tree listing for proper automation.\n\nWhat are my options?\n\nThanks!\n\nJosh\n"},{"id":"155319","messageId":"4CD68662.4060709@gmx.de","threadId":"25586","inReplyTo":"4CCA6623.8090705@workspacewhiz.com","subject":"Re: git diff-tree against the root commit","fromName":"Christoph Mallon","fromEmail":"christoph.mallon@gmx.de","sentAt":"2010-11-07T10:58:42Z","receivedAt":"2010-11-07T10:58:42Z","isPatch":false,"sender":{"key":"christoph.mallon@gmx.de","avatar":"https://avatars.githubusercontent.com/u/20772248?v=4"},"body":"On 29.10.2010 08:13, Joshua Jensen wrote:\n> I am mirroring a Git repository into another SCM.  I am using 'git diff-tree' to tell me what changes I need to make to the other SCM.\n> \n> Today, I attempted to mirror a new submodule.  'git diff-tree' reported two SHAs... 0000000000000000000000000000000000000000 and the revision the submodule currently resides at.  I attempted to run a 'git diff-tree' within the submodule for the all zero SHA and the revision specified, but apparently, 0000000000000000000000000000000000000000 does not really represent the root commit and does not work.  I then discovered the --root option, but that doesn't seem to give me the complete file list either.\n> \n> 'git diff-tree' has been working great for everything else, but I really need a root commit diff-tree listing for proper automation.\n> \n> What are my options?\n\nDiff against the empty tree. This gives you the treeish of the empty tree:\n\tgit mktree < /dev/null\nThe result is 4b825dc642cb6eb9a060e54bf8d69288fbee4904. This magic number is used in git in several places. git's behaviour with parentless commits is somewhat annoying and/or broken.\n"},{"id":"155335","messageId":"AANLkTimiyFhggBvK-AGqRnMXta65rEJvJSeQ+QGOnZWp@mail.gmail.com","threadId":"25586","inReplyTo":"4CD68662.4060709@gmx.de","subject":"Re: git diff-tree against the root commit","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2010-11-07T17:23:25Z","receivedAt":"2010-11-07T17:23:25Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Sun, Nov 7, 2010 at 2:58 AM, Christoph Mallon\n<christoph.mallon@gmx.de> wrote:\n> On 29.10.2010 08:13, Joshua Jensen wrote:\n>> I am mirroring a Git repository into another SCM.  I am using 'git diff-tree' to tell me what changes I need to make to the other SCM.\n>>\n>> Today, I attempted to mirror a new submodule.  'git diff-tree' reported two SHAs... 0000000000000000000000000000000000000000 and the revision the submodule currently resides at.  I attempted to run a 'git diff-tree' within the submodule for the all zero SHA and the revision specified, but apparently, 0000000000000000000000000000000000000000 does not really represent the root commit and does not work.  I then discovered the --root option, but that doesn't seem to give me the complete file list either.\n>>\n>> 'git diff-tree' has been working great for everything else, but I really need a root commit diff-tree listing for proper automation.\n>>\n>> What are my options?\n>\n> Diff against the empty tree.\n\nThat works, but it's a bit too technical.\n\nThe traditional way to do it is to just\n\n   git diff-tree --root <commit>\n\nwhere the magic \"--root\" option is just the flag to say \"I want to see\nthe root as a diff too\". The reason it isn't the default is\nhistorical: since git started out for the kernel, and since the root\nis an import from another tree, showing the root as a patch was\nannoying.\n\nYou have to realize that back in the original coding days (when git\nread-tree was introduced), it was meant for very basic scripting. What\nis now \"git log -p\" used to be basically\n\n  git-rev-list $(cat .git/HEAD) | git-diff-tree --stdin\n\nand with the target being the kernel, the default of not showing that\nfirst commit was a sane one (and going back even further,\ngit-diff-tree really only worked on trees, so you had to give explicit\nbeginning and end points).\n\nOf course, by the time we actually had a \"git log\" command, I think\nthat default had already changed. But it still explains why there is a\nseparate option to show the root commit with a patch.\n\n                                 Linus\n"}]}