git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Joey Hess <id@joeyh.name>
Cc: Duy Nguyen <pclouds@gmail.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: git ls-files wildcard behavior considered harmful
Date: Mon, 30 Mar 2015 20:09:24 -0400	[thread overview]
Message-ID: <20150331000924.GA27090@peff.net> (raw)
In-Reply-To: <20150330233614.GA17089@kitenet.net>

On Mon, Mar 30, 2015 at 07:36:14PM -0400, Joey Hess wrote:

> 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..

Pretty much everything takes magic patterns[1]. Pathspecs given to diff,
path limiters for pruning, etc. If you are scripting with raw filenames
(e.g., feeding the filenames out of another tool), I recommend setting
GIT_LITERAL_PATHSPECS everywhere. That's what we do on the server side
at GitHub (and is the reason I implemented --literal-pathspecs in the
first place).

-Peff

[1] Note that globbing is just part of this. Names starting with colon
    are also magical, e.g. ":/foo", or even ":(literal)foo".  These are
    documented in the "pathspec" definition of "git help glossary".

  reply	other threads:[~2015-03-31  0:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 23:04 git ls-files wildcard behavior considered harmful Joey Hess
2015-03-30 23:16 ` Duy Nguyen
2015-03-30 23:36   ` Joey Hess
2015-03-31  0:09     ` Jeff King [this message]
2015-03-31  0:35     ` Duy Nguyen
2015-03-30 23:24 ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150331000924.GA27090@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=id@joeyh.name \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).