* [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/
@ 2014-09-21 18:04 Rémi Vanicat
2014-09-21 19:52 ` Torsten Bögershausen
0 siblings, 1 reply; 4+ messages in thread
From: Rémi Vanicat @ 2014-09-21 18:04 UTC (permalink / raw)
To: git Maling list
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).
--
Rémi Vanicat
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/
2014-09-21 18:04 [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/ Rémi Vanicat
@ 2014-09-21 19:52 ` Torsten Bögershausen
2014-09-22 1:24 ` Duy Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Torsten Bögershausen @ 2014-09-21 19:52 UTC (permalink / raw)
To: Rémi Vanicat, git Maling list
On 2014-09-21 20.04, Rémi Vanicat wrote:
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/
2014-09-21 19:52 ` Torsten Bögershausen
@ 2014-09-22 1:24 ` Duy Nguyen
2014-09-22 13:01 ` Duy Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Duy Nguyen @ 2014-09-22 1:24 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: Rémi Vanicat, git Maling list
On Mon, Sep 22, 2014 at 2:52 AM, Torsten Bögershausen <tboegi@web.de> wrote:
> 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.
From the top of my head, pathspec should match as if it's literal
string too. Not sure if it applies to this case. I'll check later..
--
Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/
2014-09-22 1:24 ` Duy Nguyen
@ 2014-09-22 13:01 ` Duy Nguyen
0 siblings, 0 replies; 4+ messages in thread
From: Duy Nguyen @ 2014-09-22 13:01 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: Rémi Vanicat, git Maling list
On Mon, Sep 22, 2014 at 8:24 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Mon, Sep 22, 2014 at 2:52 AM, Torsten Bögershausen <tboegi@web.de> wrote:
>> 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.
>
> From the top of my head, pathspec should match as if it's literal
> string too. Not sure if it applies to this case. I'll check later..
FWIW the "problem" is in dir.c, function common_prefix_len(). We use
this one to determine a shared parent directory, e.g. foo/bar and
foo/baarr share "foo/", so that we could start looking for untracked
files from "foo" instead of ".". The shared directory search only
cares about non-wildcard letters. So in the case of "foo/" it finds
the "shared" dir "foo", but in "foo[b]/" it stops at '[' and decides
the shared dir is ".".
But this difference should not lead to any differences in output
because that's more about traversal optimization. But somehow we treat
the first directory different than subdirs. If a subdir is entirely
untracked/ignored, we show "subdir/" (with -unormal) but if it's the
first examined directory then we show everything inside. This is
something we should fix if you guys really depend on a consistent
behavior. But if it's fixed, then "foo/" case above would show "foo/"
not "foo/bar". Or just call it a quirk of -unormal and magit should
use -uall instead.
--
Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-22 13:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-21 18:04 [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/ Rémi Vanicat
2014-09-21 19:52 ` Torsten Bögershausen
2014-09-22 1:24 ` Duy Nguyen
2014-09-22 13:01 ` Duy Nguyen
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).