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

Re: [PATCH] git-rev-list: add --exclude-path-first-parent flag

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2021, 00:45 UTC
Message-ID
<xmqqzgxxivrb.fsf@gitster.g>
In-Reply-To
<20210417001525.19960-1-jerry@skydio.com>
Jerry Zhang <jerry@skydio.com> writes:
Show 17 quoted lines
> Add the --exclude-path-first-parent flag,
> which works similarly to --first-parent,
> but affects only the graph traversal for
> the set of commits being excluded.
>
>    -A-------E-HEAD
>      \     /
>       B-C-D
>
> In this example, the goal is to return the
> set {B, C, D} which represents a working
> branch that has been merged into main branch
> E. `git rev-list D ^E` will end up returning
> no commits since the exclude path eliminates
> D and its ancestors.
> `git rev-list --exclude-path-first-parent D ^E`
> however will return {B, C, D} as desired.

It is not clera why you want to have this, instead of doing a more obvious "D..E^". Even better is "E^..E", which is often what you want when viewing a history like my 'seen' that is a straight-line into which tips of branches are merged.

E^..E (or doing the same for any commit on the mainline in such a history whose first-parent chain solely consists of merges) would show the list of the commits that came from the side branch that was merged, plus the merge commit, where the committer who created a merge would hava a chance to give a summary of what happened on the side branch.

Previous: Jerry ZhangNext: Jerry Zhang
Message 2 of 9 in “git-rev-list: add --exclude-path-first-parent flag”
  1. git-rev-list: add --exclude-path-first-parent flagJerry Zhang, Apr 17, 2021
  2. Junio C HamanoApr 17, 2021
  3. Jerry ZhangApr 17, 2021
  4. Felipe ContrerasApr 17, 2021
  5. Junio C HamanoApr 17, 2021
  6. Jerry ZhangApr 21, 2021
  7. git-rev-list: add --first-parent-not flagJerry Zhang, Apr 21, 2021
  8. git-rev-list: add --first-parent-not flagJerry Zhang, Jul 28, 2021
  9. Jerry ZhangDec 11, 2021

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.