git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] ls-files '**' globstar matches one or more directories instead of zero or more directories

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 16, 2017, 10:53 UTC
Message-ID
<CACsJy8ASuQqnZb97BmPtOeAoTuS4bE6-7p21SDd9DP6SNyX+3Q@mail.gmail.com>
In-Reply-To
<CAO-Op+GujOUuueqwOKbb1NosZ-VYY5KVWm1+HNMC8xhd0ApEDw@mail.gmail.com>
On Sat, Apr 15, 2017 at 2:17 AM, Alistair Buxton <a.j.buxton@gmail.com> wrote:
Show 13 quoted lines
> To reproduce, go to any git repository and run:
>
>     diff <(git ls-files '**/*' | sort) <(git ls-files | sort)
>
> Expected result: No output since both commands should produce identical output.
>
> Actual result: '**/*' only matches files at least one directory deep.
>
> The same happens with eg '**/Makefile' - only Makefiles in
> subdirectories are listed.
>
> I have personally tested with 2.7.8 and 2.12.0. Others on IRC report
> that this happens in the next branch.
Another data point. t3070-wildmatch.sh has a test for this case
match 1 0 'foo' '**/foo'

so the pattern matching machinery is _not_ broken. There may be some changes in ls-files (pathspec-related?) that leads to this. But I didn't try to bisect it.

-- 
Duy
Previous: Alistair BuxtonNext: Duy Nguyen
Message 2 of 5 in “[BUG] ls-files '**' globstar matches one or more directories instead of zero or more directories”
  1. Alistair BuxtonApr 14, 2017
  2. Duy NguyenApr 16, 2017
  3. Duy NguyenApr 16, 2017
  4. Alistair BuxtonApr 16, 2017
  5. Alistair BuxtonApr 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.