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

Re: Bug when git rev-list options "--first-parent" and "--ancestry-path" are used together?

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2013, 17:20 UTC
Message-ID
<7vtxltfwaa.fsf@alter.siamese.dyndns.org>
In-Reply-To
<519DEA48.10108@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 30 quoted lines
> It seems to me that
>
>      git rev-list --first-parent --ancestry-path A..B
>
> is well-defined and should list the commits in the intersection between
>
>      git rev-list --first-parent                 A..B
>
> and
>
>      git rev-list                --ancestry-path A..B
>
> But in many cases the first command doesn't provide any output even
> though there are commits common to the output of the last two commands.
>
> For example, take as an example the DAG from test t6019:
>
> #          D---E-------F
> #         /     \       \
> #    B---C---G---H---I---J
> #   /                     \
> #  A-------K---------------L--M
>
> (The merges are always downwards; e.g., the first parent of commit L is
> K.)  The command
>
>     git rev-list --first-parent --ancestry-path D..J
>
> doesn't generate any output, whereas I would expect it to output "H I
> J".

As I do not see how "only show first-parent chains from near the tip but stop immediately when the chain deviates from the ancestry path" could be a sensible operation (in other words, I do not offhand think of examples of what useful things you can do with that information), I actually expect that "-f-p -a-p D..J" should error out, instead of giving no output.

You are correct to point out that sometimes -f-p and -a-p _could_ be compatible, e.g. "-f-p -a-p A..M", or "-f-p -a-p B..M". But I think the only case that they are compatible is when "-f-p" output is a strict subset of what "-a-p" without "-f-p" would give.

Previous: Michael HaggertyNext: Michael Haggerty
Message 2 of 4 in “Bug when git rev-list options "--first-parent" and "--ancestry-path" are used together?”
  1. Michael HaggertyMay 23, 2013
  2. Junio C HamanoMay 23, 2013
  3. Michael HaggertyMay 25, 2013
  4. Michael HaggertyMay 25, 2013

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.