From: Michael J Gruber <git@drmicha.warpmail.net>
To: Anatol Pomozov <anatol.pomozov@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Diff-tree does not work for initial commit
Date: Mon, 15 Sep 2008 23:09:01 +0200 [thread overview]
Message-ID: <48CECEED.3080105@drmicha.warpmail.net> (raw)
In-Reply-To: <48CECA42.1050209@drmicha.warpmail.net>
Michael J Gruber venit, vidit, dixit 15.09.2008 22:49:
> 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
Ooops, that man page is just too long. Scrolling way down:
"git commit-tree --root" treats the root as a commit with an empty tree.
So this does what you want.
But you may want to look into porcelain like
git show --pretty=format: --name-only
Michael
next prev parent reply other threads:[~2008-09-15 21:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-15 20:01 Diff-tree does not work for initial commit Anatol Pomozov
2008-09-15 20:49 ` Michael J Gruber
2008-09-15 20:54 ` Junio C Hamano
2008-09-15 21:48 ` Anatol Pomozov
2008-09-15 21:09 ` Michael J Gruber [this message]
2008-09-15 21:11 ` Sverre Rabbelier
2008-09-15 22:34 ` Jeff King
2008-09-16 6:19 ` Sverre Rabbelier
2008-09-16 6:21 ` Jeff King
2008-09-18 9:21 ` [RFC/PATCH] extend meaning of "--root" option to index comparisons Jeff King
2008-09-18 16:31 ` Anatol Pomozov
2008-09-18 16:51 ` Sverre Rabbelier
2008-09-19 14:25 ` Jeff King
2008-09-19 16:54 ` Anatol Pomozov
2008-09-19 17:39 ` Jeff King
2008-09-19 20:27 ` Re* " Junio C Hamano
2008-09-21 13:56 ` Jeff King
2008-09-21 15:58 ` Anatol Pomozov
2008-09-21 17:04 ` Jakub Narebski
2008-09-22 13:15 ` Jeff King
2008-09-21 18:48 ` Junio C Hamano
2008-09-22 13:32 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48CECEED.3080105@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=anatol.pomozov@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.