git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Guess the base-commit of a series
@ 2020-04-30 17:21 Konstantin Ryabitsev
  2020-04-30 17:33 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Ryabitsev @ 2020-04-30 17:21 UTC (permalink / raw)
  To: git

Hello:

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)?

-K

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guess the base-commit of a series
  2020-04-30 17:21 Guess the base-commit of a series Konstantin Ryabitsev
@ 2020-04-30 17:33 ` Eric Wong
  2020-04-30 19:49   ` Junio C Hamano
  2020-04-30 19:52   ` Konstantin Ryabitsev
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Wong @ 2020-04-30 17:33 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: git

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> Hello:
> 
> 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...

Indexing git repos to store a reverse mapping of
blobs => commits/trees/tags is something I've been planning
as part of public-inbox (for the "solver" subcomponent which
recreates blobs from patch mails, I want it to recreate trees).

I'm not sure if/when I'll get around to it; and it's
space-intensive with Xapian, too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guess the base-commit of a series
  2020-04-30 17:33 ` Eric Wong
@ 2020-04-30 19:49   ` Junio C Hamano
  2020-04-30 19:52   ` Konstantin Ryabitsev
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2020-04-30 19:49 UTC (permalink / raw)
  To: Eric Wong; +Cc: Konstantin Ryabitsev, git

Eric Wong <e@yhbt.net> writes:

> Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
>> Hello:
>> 
>> 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...

Me neither.

I am assuming that this is in the context of the kernel project,
where there are numerous but manageable number of well known
repositories, so Konstantin can probably create a (bare) repository
that fetches from all of them into refs/remotes/{linus,next,...}/
remote-tracking branches.  With that, running this command

    $ git rev-list --all | git diff-tree --stdin --raw -r

and write a script that parses its output may not be too hard.

I am not sure what Konstantin wanted to say with "the latest branch
commit", but if the starting point (i.e. branch) is known, then such
a script can read from the output of the above pipeline but instead
of starting from "--all", start the traversal from the branch tip.

There may not be any such tree with all those blobs.  For the second
patch in an N-patch series, there won't be such a tree anywhere
other than the author's repository unless the first patch of the
series has been applied somewhere well known.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guess the base-commit of a series
  2020-04-30 17:33 ` Eric Wong
  2020-04-30 19:49   ` Junio C Hamano
@ 2020-04-30 19:52   ` Konstantin Ryabitsev
  1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Ryabitsev @ 2020-04-30 19:52 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

On Thu, Apr 30, 2020 at 05:33:02PM +0000, Eric Wong wrote:
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-30 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 17:21 Guess the base-commit of a series Konstantin Ryabitsev
2020-04-30 17:33 ` Eric Wong
2020-04-30 19:49   ` Junio C Hamano
2020-04-30 19:52   ` Konstantin Ryabitsev

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