From: Jacob Keller <jacob.e.keller@intel.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH v4 3/3] diff --no-index: support limiting by pathspec
Date: Wed, 24 Sep 2025 11:19:58 -0700 [thread overview]
Message-ID: <5da981d0-0a9c-4840-b413-54ec29d349e6@intel.com> (raw)
In-Reply-To: <35e55d20-d4aa-4b88-aa93-9192612fd1b8@gmx.de>
[-- Attachment #1.1: Type: text/plain, Size: 2065 bytes --]
On 9/24/2025 4:19 AM, Johannes Schindelin wrote:
> Hi Jacob,
>
> On Tue, 23 Sep 2025, Jacob Keller wrote:
>
>> On 9/23/2025 7:57 AM, Johannes Schindelin wrote:
>>
>>> However, this makes me wonder whether the logic itself is sound? It is
>>> not immediately obvious to me why the `paths[0]` and `paths[1]` values
>>> aren't matched against the pathspec yet their entirety is seemingly
>>> skipped in `read_directory_contents()`?
>>
>> I recall fiddling a lot to try and get this working. The idea here is
>> that fixup_paths does some conversions to handle the DWIM logic where a
>> "diff D F" becomes "diff D/F F". It returns true if both paths are
>> directories, so we only enter this block when both paths are
>> directories. (Which is required because we only support pathspec
>> limiting for directory differences).
>
> I do wonder, after seeing that `read_directory_contents()` has to
> (re-)construct a complete `strbuf` in every single invocation whether it
> would make more sense to construct two `strbuf`s in `diff_no_index()` and
> pass those along to `queue_diff()` _instead_ of `skip1`/`skip2`. The
> `queue_diff()` function would then have to extend these
> `strbuf`s as it already does with `buffer1`/`buffer2`.
>
> That would avoid appending the same prefix only to remove it right away
> (with a not exactly cheap `memmove()`) during every
> `read_directory_contents()` invocation, too, in addition to allocating and
> releasing those `strbuf`s over and over again.
>
> Ciao,
> Johannes
Something like that is probably simpler, but I'd need to figure out how
to do things right. I'm also not 100% certain how much it would save on
computation.
What we ultimately want to construct is the ability to figure out that
we're given A/B/C/D path and a filename E and a prefix A/B, we want to
get C/D/E for use with the pathspec matching logic.
So we still need to do some sort of prefix matching here, because
queue_diff gets (and indeed, needs) the full path for its main
non-pathspec purpose.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2025-09-24 18:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 23:29 [PATCH v4 0/3] diff: add pathspec support to --no-index Jacob Keller
2025-05-21 23:29 ` [PATCH v4 1/3] pathspec: add match_leading_pathspec variant Jacob Keller
2025-05-21 23:29 ` [PATCH v4 2/3] pathspec: add flag to indicate operation without repository Jacob Keller
2025-05-21 23:29 ` [PATCH v4 3/3] diff --no-index: support limiting by pathspec Jacob Keller
2025-06-04 2:37 ` Ben Knoble
2025-06-04 17:22 ` Jacob Keller
2025-06-04 18:27 ` Jacob Keller
2025-06-04 20:19 ` Junio C Hamano
2025-06-04 21:05 ` Jacob Keller
2025-06-04 21:36 ` D. Ben Knoble
2025-06-04 23:22 ` Junio C Hamano
2025-09-23 14:57 ` Johannes Schindelin
2025-09-23 22:48 ` Jacob Keller
2025-09-24 11:19 ` Johannes Schindelin
2025-09-24 18:19 ` Jacob Keller [this message]
2025-09-24 18:23 ` Jacob Keller
2025-05-22 21:37 ` [PATCH v4 0/3] diff: add pathspec support to --no-index Junio C Hamano
2025-05-22 21:50 ` Jacob Keller
2025-05-22 22:04 ` Junio C Hamano
2025-06-03 21:12 ` Junio C Hamano
2025-06-04 2:32 ` Ben Knoble
2025-06-05 15:34 ` Phillip Wood
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=5da981d0-0a9c-4840-b413-54ec29d349e6@intel.com \
--to=jacob.e.keller@intel.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@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 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 NNTP newsgroup(s).