git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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:23:42 -0700	[thread overview]
Message-ID: <c919ef8a-cf37-4ee7-9713-775246bc7243@intel.com> (raw)
In-Reply-To: <5da981d0-0a9c-4840-b413-54ec29d349e6@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 1823 bytes --]



On 9/24/2025 11:19 AM, Jacob Keller wrote:
> 
> 
> 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`.
>>

Ah, but I see what you meant better after some more thought. Instead of
bothering with skip1 and skip2 at all, we just generate the sub part of
the path along with buffer1/buffer2, but we start these new pathspec
bits empty, so that we can construct the proper C/D/E path in
read_directory_contents directly without needing to do a skip or memmove
etc.

Makes sense. Good suggestion!

I'll try to work on this today and make a test case to confirm this.

Thanks,
Jake

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-09-24 18:23 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
2025-09-24 18:23           ` Jacob Keller [this message]
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=c919ef8a-cf37-4ee7-9713-775246bc7243@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).