Web lists-archives.com

Re: [PATCH] add--interactive: do not expand pathspecs with ls-files




On Tue, Mar 14, 2017 at 10:25:04AM -0700, Brandon Williams wrote:

> On 03/14, Jeff King wrote:
> >   b. If the repository contains filenames with literal wildcard
> >      characters (e.g., "foo*"), the original code expanded
> >      them via "ls-files" and then fed those wildcard names
> >      to "diff-index", which would have treated them as
> >      wildcards. This was a bug, which is now fixed (though
> >      unless you really go through some contortions with
> >      ":(literal)", it's likely that your original pathspec
> >      would match whatever the accidentally-expanded wildcard
> >      would anyway).
> > 
> >      So this takes us one step closer to working correctly
> >      with files whose names contain wildcard characters, but
> >      it's likely that others remain (e.g., if "git add -i"
> >      feeds the selected paths to "git add").
> 
> It definitely makes things more difficult when people use wildcard
> characters in filenames.  Is there any reason people use wildcards as
> literal characters in filenames other than them not knowing any better?

The philosophers of the ages have struggled with the question of why
users do anything.

I suspect that wildcards in filenames are pretty uncommon, just judging
from the lack of complaints. But they do come up. The most recent one
was:

  http://public-inbox.org/git/c9876671-6252-5dfa-18df-a6719dc6834c@xxxxxxxxx/

It's unclear if that was stimulated by a real-world case, or just
mucking around.

-Peff