git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "git log -- SHA-1" - how to get/simulate this functionality?

From
ESEugene Sajine <euguess@gmail.com>
Date
Apr 26, 2010, 20:07 UTC
Message-ID
<g2l76c5b8581004261307g39f96c6en36588bfea6640ac5@mail.gmail.com>
In-Reply-To
<y2n81b0412b1004261237w1c9221dn1ac75a29f50cb74d@mail.gmail.com>
On Mon, Apr 26, 2010 at 3:37 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 19 quoted lines
> On Mon, Apr 26, 2010 at 20:57, Alex Riesen <raa.lkml@gmail.com> wrote:
>> On Mon, Apr 26, 2010 at 20:22, Eugene Sajine <euguess@gmail.com> wrote:
>>> Well thank you for that, but that gives me what i already know - the content.
>>> I need to "reverse engineer" the history by having only the content
>>> and its SHA-1 in order to indentify the last commitID and get all
>>> relevant info (author, date etc. )
>>
>> Hmm. In that case, your using of git log look like a good way to get the
>> information. If you wanted an output format which is better suited for
>> automated parsing, you can look at "git rev-list --pretty=format:...",
>> let it output only commit and tree hashes, and grep the output of
>> "git ls-tree" for your hash...
>
> Actually, "git log --no-abbrev --raw --oneline" looks very simple to parse.
> By the way, you may get ambiguous results: any file any time could have
> had the given hash. IOW, by looking at the whole history you may see different
> files having the same hash. It does mean the same content, so maybe its
> OK for your purposes.
>

Yes this looks a bit better, but still not "grep"-able easily as grep SHA-1 cuts off the commit ID. I'm wondering why this "simple" feature which actually solves (almost) the problem of "keyword expansion" substitution for git once and for all is not yet there...:(

While i do realize that i might have ambiguous results and first of all because the same blob can exist in creation commits, modification and move, but mostly people are interested in the last commit of this particular file/blob. So, i would say, it is very rare that at any given point of time there will be two objects with the same hash in repo.

It is a feature request than:)

Please, somebody take a look at the possibility to develop a variant of "git log" or rev-list which would show the commits in which the given blob SHA-1 has participated.

Thanks, Eugene

Previous: Alex Riesen
Message 7 of 7 in “"git log -- SHA-1" - how to get/simulate this functionality?”
  1. Eugene SajineApr 26, 2010
  2. Eugene SajineApr 26, 2010
  3. Alex RiesenApr 26, 2010
  4. Eugene SajineApr 26, 2010
  5. Alex RiesenApr 26, 2010
  6. Alex RiesenApr 26, 2010
  7. Eugene SajineApr 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.