From: Duy Nguyen Date: Mon, 30 Mar 2015 23:16:52 GMT Subject: Re: git ls-files wildcard behavior considered harmful Message-ID: In-Reply-To: <20150330230459.GA13927@kitenet.net> On Tue, Mar 31, 2015 at 6:04 AM, Joey Hess wrote: > I was very surprised to learn the other day that git ls-files 'foo*' > will expand wildcards (including character classes), in the absence of > expansion by the shell. (git version 2.1.4) > > joey@darkstar:~/tmp/aaa>git ls-files 'foo*bar' > foo*bar > foobazbar > joey@darkstar:~/tmp/aaa>git ls-files '[abc]' > [abc] > a > b > > As far as I can see this behavior is not documented on the man page, > except for a tiny mention in the --with-tree documentation, where > it says " (i.e. path pattern)". > > Since I wanted to avoid this wildcard expension, I tried slash-escaping > the wildcard characters. You can do "git --literal-pathspecs ls-files ..." or set GIT_LITERAL_PATHSPECS. -- Duy