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

Re: git ls-files wildcard behavior considered harmful

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 31, 2015, 00:35 UTC
Message-ID
<CACsJy8C9VdpN2MoNC7-ZuLAvjV5fUZVLzMM-gUzjj1ZQ5r9Vtg@mail.gmail.com>
In-Reply-To
<20150330233614.GA17089@kitenet.net>
On Tue, Mar 31, 2015 at 6:36 AM, Joey Hess <id@joeyh.name> wrote:
Show 8 quoted lines
> Duy Nguyen wrote:
>> You can do "git --literal-pathspecs ls-files ..." or set GIT_LITERAL_PATHSPECS.
>
> Thanks! --literal-pathspecs does allow getting around this.
>
> Now I'm wondering what other parts of plumbing might be doing globbing
> that I did not anticipate. Maybe I should set the environment variable
> so I don't need to worry about it..

We're just a bit sloppy in documentation. ls-files learned about wildcards since 56fc510 ([PATCH] git-ls-files: generalized pathspecs - 2005-08-21). Two months later, git-ls-files.txt is updated to say "<file>" (which is not entirely correct even if we ignore wildcards, ls-files can take directories as well). With latest git, I think only git-mv and git-read-tree go with plain paths. It's probably best to set GIT_LITERAL_PATHSPECS for scripting like Jeff said.

-- 
Duy
Previous: Jeff KingNext: Jonathan Nieder
Message 5 of 6 in “git ls-files wildcard behavior considered harmful”
  1. Joey HessMar 30, 2015
  2. Duy NguyenMar 30, 2015
  3. Joey HessMar 30, 2015
  4. Jeff KingMar 31, 2015
  5. Duy NguyenMar 31, 2015
  6. Jonathan NiederMar 30, 2015

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.