From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>
Subject: [PATCH 0/2] Allow --ancestry-path to take an argument
Date: Wed, 17 Aug 2022 02:48:16 +0000 [thread overview]
Message-ID: <pull.1303.git.1660704498.gitgitgadget@gmail.com> (raw)
This came out of a previous thread[1], where I wanted to be able to run
something like
git log --oneline --ancestry-path=ab/submodule-cleanup main..seen
and see the commits in main..seen which contained ab/submodule-cleanup in
their ancestry path. Let me start by defining the terminology "X is in a
commit's ancestry path". By that, I just mean that either the commit is X,
the commit is an ancestor of X, or the commit is a descendant of X. With
that definition...
The command
git log --ancestry-path A..B
means find the commits in A..B which contain A in their ancestry path. I
sometimes still want to use A..B to get the basic range, but would like to
use a commit other than A for specifying which ancestry path is of interest.
So, for example, I might want to use
git log --ancestry-path=C A..B
to mean find the commits in A..B which contain C in their ancestry path, or
use
git log --ancestry-path=C --ancestry-path=D A..B
to mean find the commits in A..B which contain either C or D in their
ancestry path.
This series implements this request, by allowing --ancestry-path to take an
optional argument. With it, I can find the answer to my question in the
thread at [1] within the git.git repository (replacing branch names with
actual hashes since the branches have since moved on):
$ git log --oneline --ancestry-path=5b893f7d81 8168d5e9c2..ac0248bfba | wc -l
36
This returns the answer I want, whereas dropping the '=5b893f7d81' from the
command line gives me 192 unwanted commits (228 total), and various other
command line flags (--first-parent, --boundary, etc.) also fail to give me
the set of commits I am looking for.
[1]
https://lore.kernel.org/git/CABPp-BF+8aqysioP_e27Q9kJ02rE2SuSqXu+XphzKWnk5a_Q+A@mail.gmail.com/
Elijah Newren (2):
rev-list-options.txt: fix simple typo
revision: allow --ancestry-path to take an argument
Documentation/rev-list-options.txt | 47 +++++++++++++----
object.h | 2 +-
revision.c | 83 ++++++++++++++++++++----------
revision.h | 3 ++
t/t6019-rev-list-ancestry-path.sh | 47 ++++++++++++++++-
5 files changed, 140 insertions(+), 42 deletions(-)
base-commit: 6a475b71f8c4ce708d69fdc9317aefbde3769e25
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1303%2Fnewren%2Fancestry-path-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1303/newren/ancestry-path-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1303
--
gitgitgadget
next reply other threads:[~2022-08-17 2:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 2:48 Elijah Newren via GitGitGadget [this message]
2022-08-17 2:48 ` [PATCH 1/2] rev-list-options.txt: fix simple typo Elijah Newren via GitGitGadget
2022-08-17 2:48 ` [PATCH 2/2] revision: allow --ancestry-path to take an argument Elijah Newren via GitGitGadget
2022-08-17 22:42 ` Junio C Hamano
2022-08-18 4:01 ` Elijah Newren
2022-08-18 6:17 ` [PATCH v2 0/2] Allow " Elijah Newren via GitGitGadget
2022-08-18 6:17 ` [PATCH v2 1/2] rev-list-options.txt: fix simple typo Elijah Newren via GitGitGadget
2022-08-18 6:17 ` [PATCH v2 2/2] revision: allow --ancestry-path to take an argument Elijah Newren via GitGitGadget
2022-08-18 15:30 ` Derrick Stolee
2022-08-18 15:50 ` Ævar Arnfjörð Bjarmason
2022-08-18 16:51 ` Derrick Stolee
2022-08-18 16:56 ` Eric Sunshine
2022-08-19 1:12 ` Elijah Newren
2022-08-19 2:45 ` Ævar Arnfjörð Bjarmason
2022-08-18 16:53 ` Eric Sunshine
2022-08-19 1:01 ` Elijah Newren
2022-08-18 22:24 ` Jonathan Tan
2022-08-19 1:23 ` Elijah Newren
2022-08-19 17:25 ` Jonathan Tan
2022-08-18 16:32 ` [PATCH v2 0/2] Allow " Junio C Hamano
2022-08-19 4:28 ` [PATCH v3 0/3] " Elijah Newren via GitGitGadget
2022-08-19 4:28 ` [PATCH v3 1/3] rev-list-options.txt: fix simple typo Elijah Newren via GitGitGadget
2022-08-19 4:28 ` [PATCH v3 2/3] t6019: modernize tests with helper Derrick Stolee via GitGitGadget
2022-08-19 4:28 ` [PATCH v3 3/3] revision: allow --ancestry-path to take an argument Elijah Newren via GitGitGadget
2022-08-19 17:54 ` Junio C Hamano
2022-08-20 0:10 ` Elijah Newren
2022-08-19 12:53 ` [PATCH v3 0/3] Allow " Derrick Stolee
2022-08-19 21:08 ` Junio C Hamano
2022-08-20 0:13 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1303.git.1660704498.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.