Re: [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Sep 21, 2014, 19:52 UTC
- Message-ID
- <541F2C96.6050101@web.de>
- In-Reply-To
- <87vbogq293.dlv@gmail.com>
On 2014-09-21 20.04, Rémi Vanicat wrote:
Show 34 quoted lines
> Hello, > > I found what look like a bug in git status: > `git status -unormal foo[b]/` won't output the content of the directory > foo[b] when `git status -unormal foo/` will output the content of the > directory foo: > > $ mkdir 'foo[b]' > $ touch 'foo[b]/bar' > $ git status -unormal 'foo[b]/' > On branch master > Untracked files: > (use "git add <file>..." to include in what will be committed) > > foo[b]/ > > nothing added to commit but untracked files present (use "git add" to track) > $ mkdir 'foo' > $ touch 'foo/bar' > $ git status -unormal 'foo/' > On branch master > Untracked files: > (use "git add <file>..." to include in what will be committed) > > foo/bar > > nothing added to commit but untracked files present (use "git add" to track) > > The documentation of git status contain nothing about treating bracket > specially. Quoting the brackets do not solve the problem. > > see https://github.com/magit/magit/issues/1512 for discussion about it > (in the case of git status --porcelain). >
git status takes a "pathspec" as a parameter, which is not the same as a filename. A pathspec can contain wildcards like '*' or '?' or things like "*[ch]". This is known as shell glob syntax (or so), and used automatically by all shells.
Git allows to use "git add *.[ch]" (where the shell expands the glob) or "git add '*.[ch]'" where Git does the expansion.
You can turn of the glob handling in a pathspec by using this: GIT_LITERAL_PATHSPECS=1 git status -unormal 'foo[b]/' On branch master
Initial commit
Untracked files: (use "git add <file>..." to include in what will be committed)
foo[b]/bar ------------------- Side note: If somebody feels that the documentation can be better: we appreciate patches.