mbox series

[0/1] add: fix pathspec handling when literal filenames match wildcard

Message ID 20250412094607.236382-1-jayatheerthkulkarni2005@gmail.com (mailing list archive)
Headers show
Series add: fix pathspec handling when literal filenames match wildcard | expand

Message

JAYATHEERTH K April 12, 2025, 9:46 a.m. UTC
This patch fixes a bug in `git add` where a wildcard pathspec (e.g., 'f*')
fails to expand correctly if a file with the *exact* name ('f*') exists.
Previously, Git would incorrectly add only the literal match on the first
run and skip expanding the wildcard.

With this fix, wildcard expansion behaves consistently even in the presence
of an exact filename match.

To explicitly add the literal file, users should quote the wildcard:
    git add 'f\*'

Thanks you

K Jayatheerth (1):
  add: fix handling literal filenames and wildcards

 dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Lucas Seiki Oshiro April 12, 2025, 3:45 p.m. UTC | #1
Hi!

The original bug repot included some simple steps to reproduce
the bug. Since it is a corner case that wasn't covered by our
current test suite, it would be nice if you created a new
test case covering that.

PS: Since this is a single patch, you could sent this without
a cover letter, putting your comments after the scissors mark
(---).
JAYATHEERTH K April 12, 2025, 5:34 p.m. UTC | #2
On Sat, Apr 12, 2025 at 9:15 PM Lucas Seiki Oshiro
<lucasseikioshiro@gmail.com> wrote:
>
> Hi!

Hey Lucas!

>
> The original bug repot included some simple steps to reproduce
> the bug. Since it is a corner case that wasn't covered by our
> current test suite, it would be nice if you created a new
> test case covering that.
>
Yeah!! I was testing them with options like f** and f\*\* for specific
file additions for commits
I have framed a test frame in t-3706 which is the add and pathspec
coverage as far as I can see.

> PS: Since this is a single patch, you could sent this without
> a cover letter, putting your comments after the scissors mark
> (---).

Ahh I do that because if I receive feedback it forms like a good
summary in the beginning.
But sure, I think the *scissors mark* method sounds good too!!

Will send the patch inline to this email
I think you've worked with Tests in your microproject
Drop some feedback. Those will be very helpful!!

Thank you,
-Jayatheerth