git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	kostix@bswap.ru, clime@redhat.com, git <git@vger.kernel.org>
Subject: Re: get commit ID from a tree object ID
Date: Mon, 26 Mar 2018 15:21:06 -0700	[thread overview]
Message-ID: <20180326222106.GC21735@aiede.svl.corp.google.com> (raw)
In-Reply-To: <CAGZ79kZU39B42BeOxrUDxT6Nca0=Yd+O0TEgu6_HvK3O=b2KhQ@mail.gmail.com>

Hi,

Stefan Beller wrote:
> On Sat, Mar 17, 2018 at 10:57 AM Junio C Hamano <gitster@pobox.com> wrote:
>> Jeff King <peff@peff.net> writes:

>>> 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.

Experimenting a little more, I wondered if "-t" wasn't being passed
by default:

  $ git --oneline log -t --find-object=$(git rev-parse HEAD~30:Documentation/technical)
  $

No, that's not it.  Could it have to do with merges?

  $ git log --oneline -m --first-parent --find-object=$(git rev-parse HEAD~30:Documentation/technical)
  df6cfe8c30 Merge branch 'debian-experimental' into google3
  f86d5fd2e4 Merge branch 'debian-experimental' into google3

Yes.

That doesn't explain why <commit>:<path> worked for you, though. :)

Thanks,
Jonathan

      reply	other threads:[~2018-03-26 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-17 12:17 get commit ID from a tree object ID Michal Novotny
2018-03-17 13:01 ` Konstantin Khomoutov
2018-03-17 16:18   ` Jeff King
2018-03-17 17:57     ` Junio C Hamano
2018-03-26 22:14       ` Stefan Beller
2018-03-26 22:21         ` Jonathan Nieder [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180326222106.GC21735@aiede.svl.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=clime@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kostix@bswap.ru \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).