From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Matthew Hughes <mhughes@uw.co.uk>
Subject: [PATCH 0/2] Fix attr magic combined with pathspec prefix
Date: Fri, 7 Jul 2023 15:04:55 -0700 [thread overview]
Message-ID: <20230707220457.3655121-1-gitster@pobox.com> (raw)
Matthew Hughes noticed and reported that a pathspec that uses the
attribute magic with pathspec pattern does not work correctly.
After digging around, I found that
$ git ls-files ":(attr:label)"
notices that the "label" attribute is set to path "sub/file" by
listing it, and combined with a pathspec pattern, i.e.
$ git ls-files ":(attr:label)sub"
it still correctly reports "sub/file" has the "label" attribute, be
it defined in ".gitignore" or "sub/.gitignore". The case that it
does not work is the command invocation is
$ git ls-files ":(attr:label)sub/"
and the attribute "label" is defined in "sub/.gitattributes" for
"sub/file".
It turns out that the problematic invocation triggers the common
prefix optimization, which is totally broken for this case.
The first patch enhances the test coverage, and the second patch
fixes the broken common prefix optimization.
Junio C Hamano (2):
t6135: attr magic with path pattern
dir: do not feed path suffix to pathspec match
dir.c | 31 ++++++-----------------
t/t6135-pathspec-with-attrs.sh | 46 ++++++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 25 deletions(-)
--
2.41.0-318-g061c58647e
next reply other threads:[~2023-07-07 22:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 22:04 Junio C Hamano [this message]
2023-07-07 22:04 ` [PATCH 1/2] t6135: attr magic with path pattern Junio C Hamano
2023-07-07 22:04 ` [PATCH 2/2] dir: do not feed path suffix to pathspec match Junio C Hamano
2023-07-07 23:45 ` [PATCH 2/2alt] " Junio C Hamano
2023-07-08 7:16 ` René Scharfe
2023-07-08 21:35 ` [PATCH 2alt/2] dir: match "attr" pathspec magic with correct paths Junio C Hamano
2023-07-09 5:35 ` René Scharfe
2023-07-09 9:28 ` Junio C Hamano
2023-07-08 7:16 ` [PATCH 2/2] dir: do not feed path suffix to pathspec match René Scharfe
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=20230707220457.3655121-1-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mhughes@uw.co.uk \
/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).