Re: get commit ID from a tree object ID
- From
Stefan Beller <sbeller@google.com>
- Date
- Mar 26, 2018, 22:14 UTC
- Message-ID
- <CAGZ79kZU39B42BeOxrUDxT6Nca0=Yd+O0TEgu6_HvK3O=b2KhQ@mail.gmail.com>
- In-Reply-To
- <xmqqwoyay48n.fsf@gitster-ct.c.googlers.com>
On Sat, Mar 17, 2018 at 10:57 AM Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> > If you want to dig further, you can use the diff machinery to show which > > commit introduced a particular tree, like: > > > > git rev-list --all | > > git diff-tree --stdin --pretty=raw --raw -t -r | > > less +/$desired_tree > > > > That "less" will find the mentioned tree, and then you'll have to > > manually read the commit. It would be possible to do it mechanically > > with a short perl script, but I'll leave that as an exercise for the > > reader.
> Before Stefan jumps in ;-) I wonder if a recently materialized > "find-object" option to the diff family can be used here as a > sugar-coated way.
I am late to jump in, but testing the 'git log --find-object' seems to have issues with trees named by sha1 here, but the named tree via <commit>:<path> still seems to work.
It seems reasonable to be able to find trees using the find-object flag, though.
Stefan