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

Re: ls-files -i & directories

From
John Keeping <john@keeping.me.uk>
Date
May 31, 2013, 21:20 UTC
Message-ID
<20130531212022.GD1072@serenity.lan>
In-Reply-To
<CAO2Twbk5cvEa2uNKMg+n4DFokJ607yRDF0dUeBJkUOAY6BAD2A@mail.gmail.com>
On Fri, May 31, 2013 at 04:22:37PM -0400, Roland Schulz wrote:
Show 22 quoted lines
> Hi,
> 
> the gitignore rules work so that if a directory is ignored, all files
> in that directory are ignored. While that behavior isn't clearly
> documented in gitignore, this behavior is consistent across all git
> tools (status, ls-files, ...).
> 
> An exception is that listing the ignored files using "ls-files -i"
> doesn't behave the same way.
> 
> example:
> $ mkdir d
> $ touch d/f
> $ echo /d/ > .gitignore
> $ git ls-files -o --exclude-standard
> .gitignore #d/f is correctly not listed
> $ git ls-files -i --exclude-standard
> #no output
> 
> d/f isn't listed even though it is treated as an ignored file by all
> other git tools. That seems inconsistent to me. Is that behavior
> intentionally or is this a bug?

It is listed with "git ls-files -i -o --exclude-standard". The documentation says:

   Show only ignored files in the output. When showing files in the
   index, print only those matched by an exclude pattern.  When showing
   "other" files, show only those matched by an exclude pattern.
If you do this then it is shown:

$ git add -f d/f $ git ls-files -i --exclude-standard d/f

I think this is working as documented.
Previous: Roland Schulz
Message 2 of 2 in “ls-files -i & directories”
  1. Roland SchulzMay 31, 2013
  2. John KeepingMay 31, 2013

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.