Re: Question: How to find the commits in the ancestry path of seen down to _and_ including a given topic?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 21, 2022 at 8:37 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Elijah Newren <newren@xxxxxxxxx> 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

   git log --ancestry-path topic..seen

I only get N-Q, missing L & M.  If I run

   git log --ancestry-path main..seen

then I get D-Q, providing me with D-I and J-K that I don't want.

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.


An example, from git.git; 5b893f7d81 is a topic (ab/submodule-cleanup)
with 12 commits, and ac0248bfba is some older version of 'next' .  I
want all 12 commits in that topic plus all commits that are both
descendants of that tip and ancestors of that old version of 'next',
which adds up to 36 commits.  (Note that this includes the 12 commits
in ab/submodule clean, 9 commits from gc/submodule-use-super-prefix
since that happens to be a descendant of ab/submodule-cleanup, and
about 15 merge commits from merging other topics into next, but does
not include those other 15 topics.)  If I run (notice the "11" instead
of "12"):

   git log --oneline --ancestry-path 5b893f7d81~11..ac0248bfba | wc -l

it reports 35 commits -- it's just missing the first commit from the
topic.  If I change "11" to "12" to try to get that first commit too:

   git log --oneline --ancestry-path 5b893f7d81~11..ac0248bfba | wc -l

then it reports 228 commits, 192 of which I don't want.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux