All of lore.kernel.org
 help / color / mirror / Atom feed
* ls-files -i & directories
@ 2013-05-31 20:22 Roland Schulz
  2013-05-31 21:20 ` John Keeping
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Schulz @ 2013-05-31 20:22 UTC (permalink / raw)
  To: git

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?

A very similar question was asked before:
http://git.661346.n2.nabble.com/git-ls-files-ignored-and-ignored-directory-tt7570641.html
but without an answer.

Roland

-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ls-files -i & directories
  2013-05-31 20:22 ls-files -i & directories Roland Schulz
@ 2013-05-31 21:20 ` John Keeping
  0 siblings, 0 replies; 2+ messages in thread
From: John Keeping @ 2013-05-31 21:20 UTC (permalink / raw)
  To: Roland Schulz; +Cc: git

On Fri, May 31, 2013 at 04:22:37PM -0400, Roland Schulz wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-31 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 20:22 ls-files -i & directories Roland Schulz
2013-05-31 21:20 ` John Keeping

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.