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

Re: A question about git-rev-list

From
David Kastrup <dak@gnu.org>
Date
Jul 16, 2007, 21:16 UTC
Message-ID
<85bqecm4mn.fsf@lola.goethe.zz>
In-Reply-To
<alpine.LFD.0.999.0707161258560.20061@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 29 quoted lines
> On Mon, 16 Jul 2007, David Kastrup wrote:
>> 
>> if I do
>> 
>> git-rev-list --remove-empty HEAD --not some-commit -- filename | tail -1
>> 
>> do I have any guarantee that the commit id I get (if any) is a direct
>> descendant of some-commit?
>
> No. You get the guarantee that
>
>  - it's some kind of parent of HEAD
>  - it's *not* a parent of some-commit
>
> But the trivial case is a simple history like
>
> 	 /-B-\
> 	A     D
>        \-C-/
>
> (where "A" is the root commit, and "D" is the current HEAD, and there are 
> two development lines from A to  D).
>
> If you now do
>
> 	git-rev-list HEAD --not C
>
> you would generally see B on the list of commits, even though it's 
> obviously not a direct descendant of C.

Ok, thanks. As explained in a different posting, I try to tackle this now with the equivalent of

git-rev-list HEAD --parents --not B -- somefile.c | awk '/ B/{print $1}'

This will give me one descendant if there is one. The problem I have with that is that "somefile.c" renders commits uninteresting, but not if they have interesting parents (what do their parents have to do with it?). So if I have

A -> B -> B1 -> C -> HEAD

where somefile.c does not change between B and B1, then git-rev-list HEAD --not B -- somefile.c spews out HEAD C and that's it. Quite as expected. However, git-rev-list HEAD --not B --parents -- somefile.c spews out HEAD C C B1 B1 B

and look and behold, B1 became interesting because of its unlisted parent B.

There is something wrong with that.
-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Linus TorvaldsNext: Junio C Hamano
Message 3 of 4 in “A question about git-rev-list”
  1. David KastrupJul 16, 2007
  2. Linus TorvaldsJul 16, 2007
  3. David KastrupJul 16, 2007
  4. Junio C HamanoJul 17, 2007

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.