git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/

From
Duy Nguyen <pclouds@gmail.com>
Date
Sep 22, 2014, 13:01 UTC
Message-ID
<CACsJy8Dv9QxFyW32+vFQ+GE2QZyXHzoG-_ABMx3ARW=WSti2ng@mail.gmail.com>
In-Reply-To
<CACsJy8AyUKKhsdij6HAf_G=+v5xhio2-KS7HGAGY-1kzOnhf2w@mail.gmail.com>
On Mon, Sep 22, 2014 at 8:24 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 10 quoted lines
> 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
Previous: Duy Nguyen
Message 4 of 4 in “[Bug] git status -unormal -- 'foo[b]/' won't display content of 'foo[b]/”
  1. Rémi VanicatSep 21, 2014
  2. Torsten BögershausenSep 21, 2014
  3. Duy NguyenSep 22, 2014
  4. Duy NguyenSep 22, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.