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

Re: ls-files --exclude broken?

From
Jay Soffian <jaysoffian@gmail.com>
Date
Sep 15, 2010, 23:19 UTC
Message-ID
<AANLkTimYNtU7sHn4_Vx50evTWDpMK_=XgshU3ZzT+eVw@mail.gmail.com>
In-Reply-To
<7v62y661pl.fsf@alter.siamese.dyndns.org>
On Wed, Sep 15, 2010 at 7:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
>> Am I missing something really obvious here?
>>
>> kore:~/Repos/git (master)$ git ls-files | wc -l
>>     2009
>
> You asked it to show the cached paths (default).  Your project currently
> tracks 2009 paths in the index.
Correct.
Show 6 quoted lines
>> kore:~/Repos/git (master)$ git ls-files -x \* | wc -l
>>     2009
>
> You told that '*' is the exclude pattern for carrying out some operation,
> but you didn't tell what operation you want.  You are shown the cached
> paths (default).

I want cached paths, minus the exclude pattern. Using -c -x \* gives the same result.

There is no indication in the man page that -x doesn't apply to -c.
Show 10 quoted lines
>> kore:~/Repos/git (master)$ git ls-files -i -x \* | wc -l
>>     2009
>
> You told that '*' is the exclude pattern, you want only paths that match
> the exclude pattern, and chose to show files in the index (which again is
> the default) by not saying -o.
>
> I've never found -i useful myself (actually I don't find many options the
> command has very useful anymore), but the above is how I read the ls-files
> manual page.

I don't care about -i myself, and maybe I should have been clearer. AFAICT, [-c] -x is broken:

$ git ls-files -c -x \* |wc -l
    2009
       -c, --cached
           Show cached files in the output (default)
       -x <pattern>, --exclude=<pattern>
           Skips files matching pattern. Note that pattern is a shell
wildcard pattern.
Oh, geez, here it is lower down in the man page:
  git ls-files can use a list of "exclude patterns" when traversing
the directory tree and finding files to show when the flags --others
or --ignored are specified. gitignore(5) specifies the format of
exclude patterns.

Bah, what use is that? Minimally ls-files shouldn't accept -x unless given either --ignored or --others if that's all it applies to. I guess this is my itch to scratch.

j.
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 4 of 17 in “ls-files --exclude broken?”
  1. Jay SoffianSep 15, 2010
  2. Nguyen Thai Ngoc DuySep 15, 2010
  3. Junio C HamanoSep 15, 2010
  4. Jay SoffianSep 15, 2010
  5. Nguyen Thai Ngoc DuySep 15, 2010
  6. Jay SoffianSep 15, 2010
  7. Jay SoffianSep 15, 2010
  8. Jeff KingSep 16, 2010
  9. Jay SoffianSep 16, 2010
  10. Jeff KingSep 16, 2010
  11. Elijah NewrenSep 15, 2010
  12. Kevin BallardSep 15, 2010
  13. Daniel JohnsonSep 15, 2010
  14. git-ls-files.txt: clarify -x/--exclude optionJay Soffian, Sep 15, 2010
  15. Jeff KingSep 16, 2010
  16. Junio C HamanoSep 16, 2010
  17. Jeff KingSep 16, 2010

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.