From: Junio C Hamano <gitster@pobox.com>
To: "Diogo Castro via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Thomas Haller <thaller@redhat.com>,
Jeff King <peff@peff.net>, Diogo Castro <dc@diogocastro.com>
Subject: Re: [PATCH] dir: fix negative pathspecs in 'git ls-files' and 'git add'
Date: Fri, 28 Aug 2026 14:37:06 -0700 [thread overview]
Message-ID: <xmqqwlta2agt.fsf@gitster.g> (raw)
In-Reply-To: <pull.2391.git.git.1787949348110.gitgitgadget@gmail.com> (Diogo Castro via GitGitGadget's message of "Fri, 28 Aug 2026 20:35:48 +0000")
"Diogo Castro via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Diogo Castro <dc@diogocastro.com>
>
> `git ls-files` calls `common_prefix()` / `get_common_prefix_len()` which
> calculate the length of the common prefix of all *positive* pathspecs,
> `max_prefix_len`.
> ...
> Solution: in `do_match_pathspec()`, only strip the prefix when handling
> positive pathspecs, not when handling negative pathspecs.
Hmph, if the command line were
git ls-files -- a/b/c a/b/d !a/b/
shouldn't we strip a/b/ from all three? Would it make sense to
leave the negative one relative to the full tree? I am wondering
if the solution is to compute common prefix across both positive and
negative ones instead.
next prev parent reply other threads:[~2026-08-28 21:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 20:35 [PATCH] dir: fix negative pathspecs in 'git ls-files' and 'git add' Diogo Castro via GitGitGadget
2026-08-28 21:37 ` Junio C Hamano [this message]
2026-08-30 14:57 ` Diogo Castro
2026-08-30 22:58 ` Junio C Hamano
[not found] ` <a8955129fcb7478f9739c8586c6975e1@CWXP265MB5784.GBRP265.PROD.OUTLOOK.COM>
2026-08-31 14:30 ` Diogo Castro
2026-08-31 18:26 ` Junio C Hamano
2026-10-02 21:52 ` Diogo Castro
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=xmqqwlta2agt.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=dc@diogocastro.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=peff@peff.net \
--cc=thaller@redhat.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.