From: Derrick Stolee <derrickstolee@github.com>
To: Elijah Newren <newren@gmail.com>, Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Question: How to find the commits in the ancestry path of seen down to _and_ including a given topic?
Date: Fri, 22 Jul 2022 07:06:51 -0400 [thread overview]
Message-ID: <8315230c-f79c-8027-9711-6e21a4bc25c4@github.com> (raw)
In-Reply-To: <CABPp-BEqWX3Nr2HDxwS9d-_QjcKb_jS=fSjsP_Pbutw7-P5gbg@mail.gmail.com>
On 7/21/22 3:34 PM, Elijah Newren wrote:
> On Thu, Jul 21, 2022 at 8:37 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Elijah Newren <newren@gmail.com> writes:
>>
>>> A simple question that I'm spinning out of [1]: How can I get `git
>>> log` to show the commits in the ancestry path from seen, back to *and
>>> including* a given topic (but not commits from unrelated topics)?
>>
>> Drawing of a sample history, please.
>>
>> I feel stupid asking this, but I do not think I even understand what
>> the question is X-<.
>>
>> Commits that are ancestors of 'seen' and are descendants of the tip
>> of the topic?
>
> What you said *plus* commits from the topic itself. From this graph:
>
> A---B---C---J---K <-- main
> |\ \
> | \ N---------------O---P---Q <-- seen
> | \ / /
> | L---M <-- topic /
> \ /
> D---E---F---G---H---I <-- other_topic
>
> I want the commits L-Q. If I run
Here is the thing I misunderstood. "topic" is already in "seen", so
a seen...topic won't work at all.
This idea is complicated by the fact that you have a concrete idea
of which commits are in "topic", but you really can't do that without
a definition of what it's based on. $(git merge-base main topic)
would get you C, but then there are multiple paths from Q to C that
don't go through topic.
You can pull out that "first" commit in topic with this:
git revlist -1 --reverse main..topic
but it only works if topic is a linear branch off of a single point
in the history of main.
> The closest I seem to be able to get is
>
> git log --ancestry-path topic~${commits_in_topic_minus_one}..seen
>
> which includes all commits I want except the first commit of the topic
> branch.
If you add --boundary, you should get that last commit as you want.
Thanks,
-Stolee
next prev parent reply other threads:[~2022-07-22 11:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 7:23 Question: How to find the commits in the ancestry path of seen down to _and_ including a given topic? Elijah Newren
2022-07-21 15:37 ` Junio C Hamano
2022-07-21 18:48 ` Derrick Stolee
2022-07-21 19:34 ` Elijah Newren
2022-07-22 11:06 ` Derrick Stolee [this message]
2022-07-22 23:25 ` Elijah Newren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8315230c-f79c-8027-9711-6e21a4bc25c4@github.com \
--to=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).