On Sat, May 3, 2025 at 11:37 AM K Jayatheerth <jayatheerthkulkarni2005@xxxxxxxxx> wrote: > > With a path with wildcard characters, e.g. 'f*o', exists in the > working tree, "git add -- 'f*o'" stops after happily finding > that there is 'f*o' and adding it to the index, without > realizing there may be other paths, e.g. 'foooo', that may match > the given pathspec. > > This is because dir.c:do_match_pathspec() disables further > matches with pathspec when it finds an exact match. > > Reported-by: piotrsiupa <piotrsiupa@xxxxxxxxx> > Helped-by: Jeff King <peff@xxxxxxxx> > Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@xxxxxxxxx> > --- > dir.c | 3 +- > t/meson.build | 1 + > t/t6137-pathspec-wildcards-literal.sh | 429 ++++++++++++++++++++++++++ > 3 files changed, 432 insertions(+), 1 deletion(-) > create mode 100755 t/t6137-pathspec-wildcards-literal.sh > > diff --git a/dir.c b/dir.c > index 28b0e03feb..9405fee83a 100644 > --- a/dir.c > +++ b/dir.c > @@ -519,7 +519,8 @@ static int do_match_pathspec(struct index_state *istate, > ( exclude && !(ps->items[i].magic & PATHSPEC_EXCLUDE))) > continue; > > - if (seen && seen[i] == MATCHED_EXACTLY) > + if (seen && seen[i] == MATCHED_EXACTLY && > + ps->items[i].nowildcard_len == ps->items[i].len) > continue; For some reason on my computer when I check the formatted patch the ps-> line align with the (seen && ...) line perfectly Again when I send the mail it is shifted forward, I ensured to use tab space instead of 4 spaces as previously asked. -Jayatheerth