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

Re: Joining cg-*-id

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 20, 2005, 14:53 UTC
Message-ID
<Pine.LNX.4.58.0509200734440.2553@g5.osdl.org>
In-Reply-To
<20050920135735.GC1884@pasky.or.cz>
On Tue, 20 Sep 2005, Petr Baudis wrote:
Show 14 quoted lines
> > 
> > So I'd love to have
> > 
> > 	git diff yesterday..
> > 
> > but the fact is, there's no sensible semantics for it. _which_ yesterday? 
> > There might be five different points that are "close to 24 hours ago", 
> > along five different paths backwards in the history.
> 
> A well-defined meaning for this from Cogito standpoint would be "the
> last commit on our HEAD before the date and all commits committed and
> merged to the HEAD". In Cogito, you don't merge two branches _together_,
> you merge one branch _into_ another (represented by the parents order),
> so this would be sensible.
No, it's _not_ sensible or well-defined.

The order of the parents does not matter. It fundamentally _cannot_ matter. I realize that both git and cogito put the "primary parent" first, but that doesn't help one iota - because git is distributed, if the other side merged and we just did a fast-forward, the "primary parent" will be the _other_ side.

In other words, anybody who thinks that the order of parents is meaningful is in for some nasty shocks. It really _fundamentally_ isn't true. I realize that's hard to accept, but it's a truism in a distributed system. You really cannot have parent ordering and distribution at the same time.

> But we would have to sort the log in merge order for this to be possible
> (and probably teach git-rev-list about it anyway).

It's not sensible regardless of how you order things. There _is_ no ordering.

So if you give a date, and there is a merge after that date, you will always have at least two ways to reach the next older commit (now, if you're lucky, it will be a common one and unambiguous, but more commonly you'll simply have _two_ commits that are "most recent commit older than the date".

And if you select one of them at random (or by deciding which parent is the "primary" one), then

	git diff yesterday..

will show not the changes since yesterday, but _all_ the changes that came in through the merge.

> By the way, did I understand it right that the only difference between
> the results of merge ordering and topo ordering is the order commits
> with regard to the order of parents?

The only guarantees topo-ordering gives is that a parent will be shown before its children. So it may still mix up commits that happened between two parallell workflows, unlike merge-order that will always show one parallell chain of development as a contiguous set of commits.

Only merge-order gives any meaning to the order of the parents, but as mentioned, that is irrelevant - a merge on the other side will "flip" the whole world-view.

And they happen.
		Linus
Previous: Petr BaudisNext: Petr Baudis
Message 7 of 22 in “Joining cg-*-id”
  1. Pavel RoskinSep 19, 2005
  2. Petr BaudisSep 19, 2005
  3. Linus TorvaldsSep 19, 2005
  4. Petr BaudisSep 19, 2005
  5. Linus TorvaldsSep 20, 2005
  6. Petr BaudisSep 20, 2005
  7. Linus TorvaldsSep 20, 2005
  8. Petr BaudisSep 20, 2005
  9. Linus TorvaldsSep 20, 2005
  10. Linus TorvaldsSep 20, 2005
  11. Paul MackerrasSep 21, 2005
  12. Linus TorvaldsSep 21, 2005
  13. Paul MackerrasSep 21, 2005
  14. Petr BaudisSep 21, 2005
  15. Matthias UrlichsSep 20, 2005
  16. Junio C HamanoSep 20, 2005
  17. Matthias UrlichsSep 20, 2005
  18. Paul MackerrasSep 20, 2005
  19. Pavel RoskinSep 19, 2005
  20. Petr BaudisSep 19, 2005
  21. Pavel RoskinSep 20, 2005
  22. Petr BaudisSep 20, 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.