From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 2/2] range-diff: optionally accept a pathspec
Date: Wed, 24 Aug 2022 14:00:11 -0700 [thread overview]
Message-ID: <xmqqh7215pd0.fsf@gitster.g> (raw)
In-Reply-To: <064b147451b04051a413b532cd97ae764ba68027.1661258122.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Tue, 23 Aug 2022 12:35:22 +0000")
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The `git range-diff` command can be quite expensive, which is not a
> surprise given that the underlying algorithm to match up pairs of
> commits between the provided two commit ranges has a cubic runtime.
>
> Therefore it makes sense to restrict the commit ranges as much as
> possible, to reduce the amount of input to that O(N^3) algorithm.
>
> In chatty repositories with wide trees, this is not necessarily
> possible merely by choosing commit ranges wisely.
>
> Let's give users another option to restrict the commit ranges: by
> providing a pathspec. That helps in repositories with wide trees because
> it is likely that the user has a good idea which subset of the tree they
> are actually interested in.
>
> Example:
>
> git range-diff upstream/main upstream/seen HEAD -- range-diff.c
>
> This shows commits that are either in the local branch or in `seen`, but
> not in `main`, skipping all commits that do not touch `range-diff.c`.
>
> Note: Since we piggy-back the pathspecs onto the `other_arg` mechanism
> that was introduced to be able to pass through the `--notes` option to
> the revision machinery, we must now ensure that the `other_arg` array is
> appended at the end (the revision range must come before the pathspecs,
> if any).
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
It is excellent that this now takes pathspec to sparsify the
history.
The implementation looks, eh, a bit dirty with obvious repetitions
in the "..." case and two-ranges cases. Three-arg cases sort-of
looks different but that is because the original one does not even
bother to ensure argv[0] and argv[1] are objects, while the new one
does, so they are essentially doing the same things.
> diff --git a/Documentation/git-range-diff.txt b/Documentation/git-range-diff.txt
> index fe350d7f405..0b393715d70 100644
> --- a/Documentation/git-range-diff.txt
> +++ b/Documentation/git-range-diff.txt
> @@ -12,6 +12,7 @@ SYNOPSIS
> [--no-dual-color] [--creation-factor=<factor>]
> [--left-only | --right-only]
> ( <range1> <range2> | <rev1>...<rev2> | <base> <rev1> <rev2> )
> + [[--] <path>...]
OK.
next prev parent reply other threads:[~2022-08-24 21:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 12:35 [PATCH 0/2] Allow passing pathspecs to git range-diff Johannes Schindelin via GitGitGadget
2022-08-23 12:35 ` [PATCH 1/2] range-diff: reorder argument handling Johannes Schindelin via GitGitGadget
2022-08-23 12:35 ` [PATCH 2/2] range-diff: optionally accept a pathspec Johannes Schindelin via GitGitGadget
2022-08-24 21:00 ` Junio C Hamano [this message]
2022-08-26 9:39 ` [PATCH v2 0/3] Allow passing pathspecs to git range-diff Johannes Schindelin via GitGitGadget
2022-08-26 9:39 ` [PATCH v2 1/3] range-diff: reorder argument handling Johannes Schindelin via GitGitGadget
2022-08-26 9:39 ` [PATCH v2 2/3] range-diff: consistently validate the arguments Johannes Schindelin via GitGitGadget
2022-08-26 16:54 ` Junio C Hamano
2022-08-26 9:39 ` [PATCH v2 3/3] range-diff: optionally accept pathspecs Johannes Schindelin via GitGitGadget
2022-08-26 17:02 ` Junio C Hamano
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=xmqqh7215pd0.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
/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.