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

Re: git-rev-list: --objects list inconsistency

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 14, 2006, 18:26 UTC
Message-ID
<Pine.LNX.4.64.0611141020480.3327@woody.osdl.org>
In-Reply-To
<4559E6A9.9A30A236@eudaptics.com>
On Tue, 14 Nov 2006, Johannes Sixt wrote:
> 
> As you can see, without --objects, master^^..master and --max-count=2
> list the same two commits.
"--max-count=X" and "master^^..master" are two TOTALLY different things.

The fact that they happened to give the same results without "--objects" is a random thing, and not at all guaranteed. For example, if "master" (or its parent) had been a merge, it probably wouldn't have given the same result even _without_ "--objects".

> But with --objects I get different object lists. I don't even know which
> one is the one to expect, but I certainly would not have expected the
> lists to be different. What's wrong here?
Nothing is wrong. You're asking for two totally different things.

With "--max-count=2", you're saying "I want the first two commits", and then the "--objects" part extends that to all the other object types too.

So you get two commits _and_ every single object reachable from those two commits.

In contrast, with "master^^..master", you're saying "I want everything that is reachable from "master", but _not_ reachable from it's grand-parent. And the "--objects" flag extends that to all the other object types too.

So you get (in this case) two commits _and_ all the objects that are reachable from those two commits but that are _not_ reachable from the grandparent.

That's a totally different thing, obviously. There's likely to be a lot of objects in common between "master" and its grandparent, and you literally asked to not be shown those objects. In the first case, you didn't ask for the exclusion of the grandparent.

So you should expect a big difference in almost all cases. In one case, you ask for an exclusion, in the other case, you just say "just the first two commits, please". Not at all equivalent.

Previous: Junio C Hamano
Message 3 of 3 in “git-rev-list: --objects list inconsistency”
  1. Johannes SixtNov 14, 2006
  2. Junio C HamanoNov 14, 2006
  3. Linus TorvaldsNov 14, 2006

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.