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

Re: Guess the base-commit of a series

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Apr 30, 2020, 19:52 UTC
Message-ID
<20200430195211.36zhvfcdrpfirewr@chatter.i7.local>
In-Reply-To
<20200430173302.GA18877@dcvr>
On Thu, Apr 30, 2020 at 05:33:02PM +0000, Eric Wong wrote:
Show 5 quoted lines
> > Given a/ b/ filenames and blob index information, is there a 
> > relatively easy way to find the latest branch commit where a patch 
> > series would apply cleanly (i.e. guess the base-commit)?
> 
> Not as far as I know...

Hmm... I'd assumed as much, given the whole "one-way" bit in "one-way hashing." :) However, I'm not very familiar with deep git internals, so wasn't sure if perhaps git kept a mapping index of sorts that could be queries.

There's a reasonable way to do it with the patches sent against the kernel, since they are likely against one of the tags created in the past few weeks. So, we just create a filename/blob index mapping and do:

git show tagname:filename | git hash-object --stdin

If we find a tagname where all the indexes match, then it's *probably* the base-commit (not guaranteed to be correct, obviously, because the patch may depend on changes made to other files in the tree, but hopefully we'll get most folks to start providing base-commit info soon and this guesswork will become increasingly obsolete).

-K
Previous: Junio C Hamano
Message 4 of 4 in “Guess the base-commit of a series”
  1. Konstantin RyabitsevApr 30, 2020
  2. Eric WongApr 30, 2020
  3. Junio C HamanoApr 30, 2020
  4. Konstantin RyabitsevApr 30, 2020

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.