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

Re: git-rev-list: proper lazy reachability

From
Linus Torvalds <torvalds@osdl.org>
Date
May 31, 2005, 15:23 UTC
Message-ID
<Pine.LNX.4.58.0505310813540.1876@ppc970.osdl.org>
In-Reply-To
<Pine.LNX.4.58.0505310735260.1876@ppc970.osdl.org>
On Tue, 31 May 2005, Linus Torvalds wrote:
> 
> You should never see a parent before a child from git-rev-list.
Actually, I take that back.

A commit that has several children will see _a_ child before the parent is shown, but while the time-based ordering means that it _likely_ will order all children before the parent, now that I think about it, that's not guaranteed to be true. You could have

	      A
	     / \
	    B   |
	     \ /
	      C
	      |
	      D

and if C has a date that is before B, then git-rev-list would traverse the tree (and show it) in the order A C B.

In fact, even D might be listed before B is (eg, the person who committed B had a clock that was set to the last century, and so the date on that was wrong).

The thing is, since B has such an "old" date, the traversal assumes that it is old and very low down in the tree, and that it's better off parsing other commits first, so it will never look more closely at B and notice that it has a parent that has already been parsed.

So I guess you'll have to wait for the end and do the toposort after all. Sorry about the confusion on my part.

		Linus
Previous: Linus TorvaldsNext: Matthias Urlichs
Message 8 of 16 in “git-rev-list: proper lazy reachability”
  1. Linus TorvaldsMay 31, 2005
  2. Jon SeymourMay 31, 2005
  3. Linus TorvaldsMay 31, 2005
  4. Linus TorvaldsMay 31, 2005
  5. Jon SeymourJun 1, 2005
  6. Paul MackerrasMay 31, 2005
  7. Linus TorvaldsMay 31, 2005
  8. Linus TorvaldsMay 31, 2005
  9. Matthias UrlichsJun 1, 2005
  10. Junio C HamanoJun 4, 2005
  11. Thomas GlanzmannJun 4, 2005
  12. Linus TorvaldsJun 4, 2005
  13. Linus TorvaldsJun 4, 2005
  14. Junio C HamanoJun 4, 2005
  15. Petr BaudisJun 4, 2005
  16. Junio C HamanoJun 4, 2005

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.