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

Re: Occasional wrong behavior of rev-walking (rev-list, log, etc.)

From
Mike Hommey <mh@glandium.org>
Date
May 22, 2015, 00:57 UTC
Message-ID
<20150522005753.GA2203@glandium.org>
In-Reply-To
<CAPc5daVnrjdjoiq8-H7vs2WAre+Kt7J5re_kZ2YD9tF8dG8UUw@mail.gmail.com>
On Thu, May 21, 2015 at 03:59:48PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> Depends on why you are running rev-list.
> 
> If you want to know if one commit is contained in another, the way
> that should work the most reliably is to use merge-base, as the
> traversal engine of that command was written not to trust the commit
> timestamps but go with the topology alone.

So, specifically, rev-list was just a side use-case that happened to show the same problem (or at least appeared to) when I was looking at what the hell was happening. I should probably have started with my actual failure instead, sorry for that. So here it is in the form of a testcase:

$ git clone https://github.com/mozilla/gecko-dev $ cd gecko-dev $ git checkout -b a 4d3f25020072867e19ad6d840a73c8d77ea040bd $ git commit --allow-empty -m a $ git checkout -b b e90de3e5e045428e8f2b732882736dc93ce05f14 $ git commit --allow-empty -m b $ git merge a -m merge $ git rebase -i e90de3e5e045428e8f2b732882736dc93ce05f14 b

This lists plenty of commits instead of just a and b, like what would happen if there weren't timestamps skews.

I've frequently used this kind of rebase in the past. It works most of the time because the situation with timestamps is generally not a problem. The reason I'm doing this kind of merge+rebase business is that I have multiple topic branches that I need to rebase on top of each other before pushing them upstream, and it's actually simpler, command- wise, than actually rebasing the topics on top of each other.

Mike
Previous: Junio C Hamano
Message 5 of 5 in “Occasional wrong behavior of rev-walking (rev-list, log, etc.)”
  1. Mike HommeyMay 21, 2015
  2. Junio C HamanoMay 21, 2015
  3. Mike HommeyMay 21, 2015
  4. Junio C HamanoMay 21, 2015
  5. Mike HommeyMay 22, 2015

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.