Re: Diff-tree does not work for initial commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anatol Pomozov venit, vidit, dixit 15.09.2008 22:01:
> Hi, It looks like I found a bug in git.
> 
> The problem: In my script I need to know what files were modified by 
> given commit. I use diff-tree for it. Although it works for most 
> cases, for initial commit it does not. Here is a sequence of actions.
> 
> 
> anatol:~ $ mkdir mkdir initialcommitissue anatol:~ $ cd
> initialcommitissue/ anatol:initialcommitissue $ git init Initialized
> empty Git repository in /home/anatol/initialcommitissue/.git/ 
> anatol:initialcommitissue $ echo "First commit" > 1.txt 
> anatol:initialcommitissue $ git add 1.txt anatol:initialcommitissue $
> git commit -m "First commit" Created initial commit 31ccc6a: First
> commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode
> 100644 1.txt anatol:initialcommitissue $ git diff-tree HEAD     <<<<<
> PROBLEM IS HERE

>From the man page:

       Compares the content and mode of the blobs found via two tree
objects.

       If there is only one <tree-ish> given, the commit is compared
with its parents (see --stdin below).

       Note that git-diff-tree can use the tree encapsulated in a commit
object.


The initial commit has no parent, so diff-tree does not know which tree
to compare to.

You can do

git diff-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD

but I guess you suggest that diff-tree should do that automatically for
a single parentless treeish: bug -> RFE

diff-tree is plumbing. Would this change break anything?

Michael
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux