{"thread":{"id":"53360","subject":"Guess the base-commit of a series","startedAt":"2020-04-30T17:21:52Z","lastAt":"2020-04-30T19:52:16Z","messageCount":4,"participants":["Konstantin Ryabitsev","Eric Wong","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396672","messageId":"20200430172147.3fblnrvi73asnkp5@chatter.i7.local","threadId":"53360","inReplyTo":null,"subject":"Guess the base-commit of a series","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2020-04-30T17:21:47Z","receivedAt":"2020-04-30T17:21:52Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"Hello:\n\nGiven a/ b/ filenames and blob index information, is there a relatively \neasy way to find the latest branch commit where a patch series would \napply cleanly (i.e. guess the base-commit)?\n\n-K\n"},{"id":"396674","messageId":"20200430173302.GA18877@dcvr","threadId":"53360","inReplyTo":"20200430172147.3fblnrvi73asnkp5@chatter.i7.local","subject":"Re: Guess the base-commit of a series","fromName":"Eric Wong","fromEmail":"e@yhbt.net","sentAt":"2020-04-30T17:33:02Z","receivedAt":"2020-04-30T17:33:03Z","isPatch":false,"sender":{"key":"e@yhbt.net","avatar":null},"body":"Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:\n> Hello:\n> \n> Given a/ b/ filenames and blob index information, is there a relatively \n> easy way to find the latest branch commit where a patch series would \n> apply cleanly (i.e. guess the base-commit)?\n\nNot as far as I know...\n\nIndexing git repos to store a reverse mapping of\nblobs => commits/trees/tags is something I've been planning\nas part of public-inbox (for the \"solver\" subcomponent which\nrecreates blobs from patch mails, I want it to recreate trees).\n\nI'm not sure if/when I'll get around to it; and it's\nspace-intensive with Xapian, too.\n"},{"id":"396687","messageId":"xmqqk11wsqim.fsf@gitster.c.googlers.com","threadId":"53360","inReplyTo":"20200430173302.GA18877@dcvr","subject":"Re: Guess the base-commit of a series","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-30T19:49:21Z","receivedAt":"2020-04-30T19:49:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <e@yhbt.net> writes:\n\n> Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:\n>> Hello:\n>> \n>> Given a/ b/ filenames and blob index information, is there a relatively \n>> easy way to find the latest branch commit where a patch series would \n>> apply cleanly (i.e. guess the base-commit)?\n>\n> Not as far as I know...\n\nMe neither.\n\nI am assuming that this is in the context of the kernel project,\nwhere there are numerous but manageable number of well known\nrepositories, so Konstantin can probably create a (bare) repository\nthat fetches from all of them into refs/remotes/{linus,next,...}/\nremote-tracking branches.  With that, running this command\n\n    $ git rev-list --all | git diff-tree --stdin --raw -r\n\nand write a script that parses its output may not be too hard.\n\nI am not sure what Konstantin wanted to say with \"the latest branch\ncommit\", but if the starting point (i.e. branch) is known, then such\na script can read from the output of the above pipeline but instead\nof starting from \"--all\", start the traversal from the branch tip.\n\nThere may not be any such tree with all those blobs.  For the second\npatch in an N-patch series, there won't be such a tree anywhere\nother than the author's repository unless the first patch of the\nseries has been applied somewhere well known.\n\n"},{"id":"396690","messageId":"20200430195211.36zhvfcdrpfirewr@chatter.i7.local","threadId":"53360","inReplyTo":"20200430173302.GA18877@dcvr","subject":"Re: Guess the base-commit of a series","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2020-04-30T19:52:11Z","receivedAt":"2020-04-30T19:52:16Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"On Thu, Apr 30, 2020 at 05:33:02PM +0000, Eric Wong wrote:\n> > Given a/ b/ filenames and blob index information, is there a \n> > relatively easy way to find the latest branch commit where a patch \n> > series would apply cleanly (i.e. guess the base-commit)?\n> \n> Not as far as I know...\n\nHmm... I'd assumed as much, given the whole \"one-way\" bit in \"one-way \nhashing.\" :) However, I'm not very familiar with deep git internals, so \nwasn't sure if perhaps git kept a mapping index of sorts that could be \nqueries.\n\nThere's a reasonable way to do it with the patches sent against the \nkernel, since they are likely against one of the tags created in the \npast few weeks. So, we just create a filename/blob index mapping and do:\n\ngit show tagname:filename | git hash-object --stdin\n\nIf we find a tagname where all the indexes match, then it's *probably* \nthe base-commit (not guaranteed to be correct, obviously, because the \npatch may depend on changes made to other files in the tree, but \nhopefully we'll get most folks to start providing base-commit info soon \nand this guesswork will become increasingly obsolete).\n\n-K\n"}]}