# Possible regression in `git grep --untracked` pathspec matching in v2.27.0

3 messages from 2020-06-03 to 2020-06-05. Participants: John Millikin, Elijah Newren.
Thread: https://gitlist.dev/t/53604

## John Millikin, 2020-06-03 03:28

Subject: Possible regression in `git grep --untracked` pathspec matching in v2.27.0
Message-ID: <CAJmdR_pG74x0Zn43MSm7zXNcoitqjjOy+WnhyGBW+oFjVFLbRQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAJmdR_pG74x0Zn43MSm7zXNcoitqjjOy%2BWnhyGBW%2BoFjVFLbRQ%40mail.gmail.com

```
In v2.26.2 and earlier, `git grep --untracked` with negative pathspec patterns
would filter out paths matching those patterns. In v2.27.0, this no longer works
as expected.

Example output:

# v2.26.2 (good)
$ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
quote.h
$

# v2.27.0 (bad)
$ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
quote.c
quote.h
$

I've bisected the change to commit 95c11ecc73f286e0a95d9591ae98f1221efe4633,
which changed the handling of path matches in callers of `fill_directory()`.

It's not clear from git-grep(1) whether the old or new behavior is "correct",
so I request that the fix include a clarification of expected semantics.

Thanks,
- John Millikin

```

## Elijah Newren, 2020-06-03 14:14

Subject: Re: Possible regression in `git grep --untracked` pathspec matching in v2.27.0
Message-ID: <CABPp-BEPOn_JL1FDA-z1jfkfej4dEbbODkcmzNWwY7V-=WsMVw@mail.gmail.com>
URL: https://gitlist.dev/e/CABPp-BEPOn_JL1FDA-z1jfkfej4dEbbODkcmzNWwY7V-%3DWsMVw%40mail.gmail.com
In-Reply-To: <CAJmdR_pG74x0Zn43MSm7zXNcoitqjjOy+WnhyGBW+oFjVFLbRQ@mail.gmail.com>

```
Hi,

On Tue, Jun 2, 2020 at 8:30 PM John Millikin <jmillikin@stripe.com> wrote:
>
> In v2.26.2 and earlier, `git grep --untracked` with negative pathspec patterns
> would filter out paths matching those patterns. In v2.27.0, this no longer works
> as expected.
>
> Example output:
>
> # v2.26.2 (good)
> $ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
> quote.h
> $
>
> # v2.27.0 (bad)
> $ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
> quote.c
> quote.h
> $
>
> I've bisected the change to commit 95c11ecc73f286e0a95d9591ae98f1221efe4633,
> which changed the handling of path matches in callers of `fill_directory()`.
>
> It's not clear from git-grep(1) whether the old or new behavior is "correct",
> so I request that the fix include a clarification of expected semantics.
>
> Thanks,
> - John Millikin

Oh, fun, an issue from _that_ series.  At least the commit you
bisected to wasn't 8d92fb292706 (dir: replace exponential algorithm
with a linear one, 2020-04-01), though.

Thanks for the detailed report.  I'll try to get some time to take a
look later this week.

Elijah

```

## Elijah Newren, 2020-06-05 18:46

Subject: Re: Possible regression in `git grep --untracked` pathspec matching in v2.27.0
Message-ID: <CABPp-BEBKyE2NVfREov6k5qML5jryLjtzw=Y21EA=fHXA0PO5A@mail.gmail.com>
URL: https://gitlist.dev/e/CABPp-BEBKyE2NVfREov6k5qML5jryLjtzw%3DY21EA%3DfHXA0PO5A%40mail.gmail.com
In-Reply-To: <CABPp-BEPOn_JL1FDA-z1jfkfej4dEbbODkcmzNWwY7V-=WsMVw@mail.gmail.com>

```
On Wed, Jun 3, 2020 at 7:14 AM Elijah Newren <newren@gmail.com> wrote:
>
> Hi,
>
> On Tue, Jun 2, 2020 at 8:30 PM John Millikin <jmillikin@stripe.com> wrote:
> >
> > In v2.26.2 and earlier, `git grep --untracked` with negative pathspec patterns
> > would filter out paths matching those patterns. In v2.27.0, this no longer works
> > as expected.
> >
> > Example output:
> >
> > # v2.26.2 (good)
> > $ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
> > quote.h
> > $
> >
> > # v2.27.0 (bad)
> > $ ./git grep --untracked --files-with-matches -e '.' -- 'quote.*' ':!quote.c'
> > quote.c
> > quote.h
> > $
> >
> > I've bisected the change to commit 95c11ecc73f286e0a95d9591ae98f1221efe4633,
> > which changed the handling of path matches in callers of `fill_directory()`.
> >
> > It's not clear from git-grep(1) whether the old or new behavior is "correct",
> > so I request that the fix include a clarification of expected semantics.
> >
> > Thanks,
> > - John Millikin
>
> Oh, fun, an issue from _that_ series.  At least the commit you
> bisected to wasn't 8d92fb292706 (dir: replace exponential algorithm
> with a linear one, 2020-04-01), though.
>
> Thanks for the detailed report.  I'll try to get some time to take a
> look later this week.

For those looking through the archives or threads later; see
https://lore.kernel.org/git/pull.803.git.git.1591381428302.gitgitgadget@gmail.com/
for the fix.  Some day, maybe I'll tweak GitGitGadget to accept
In-Reply-To...

```
