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

Re: Fwd: Unexpected behavior of ls-files command when using --others --exclude-from, and a .gitignore file which resides in a subdirectory

From
Jeff King <peff@peff.net>
Date
Jan 24, 2024, 01:09 UTC
Message-ID
<20240124010924.GB2603087@coredump.intra.peff.net>
In-Reply-To
<CAGF1KhWaOrnV8d2f_vajOT0hFK2N_8m7-p_vnZhw92ZdhXfsag@mail.gmail.com>
On Tue, Jan 23, 2024 at 06:40:10AM +0100, Raúl Núñez de Arenas Coronado wrote:
Show 15 quoted lines
> > Do you get different results from that toy repo? If not, then what is
> > different about your main repo? Do you perhaps have a stray "*" match
> > somewhere in .git/info/exclude, etc? Or are you still providing
> > --exclude-from in addition to --exclude-standard?
> 
> The difference lies in how I deal in my computer with ignored files. I
> have some files in all my repos which have to be ignored always, so I
> have that pattern in my core.excludes file. BUT those files have to be
> backed up on my system, just in case my local copy of the repo is lost
> for some reason, as they are files I need for development in my
> personal machine.
> 
> If I use --exclude-standard, no matter if those files are being
> ignored by core.excludes OR .git/info/exclude, they won't appear in
> that 'list other files' command output.

Ah, OK. I understand your case better now. Then yes, I think --exclude-per-directory is the right thing for you, since it lets you just trigger parts of the exclusion mechanism, and not all. I would say to ignore the deprecation mention in the manpage. ;)

(I think this also gives an interesting use case arguing for continuing to support those more-specific exclusion options for ls-files).

If you are mostly just using core.excludesFile (and not .git/info/exclude), then I suspect:

  git -c core.excludesFile /dev/null ls-files -o --exclude-standard

would work for you, too (but it sounds like you might also be using .git/info/exclude).

-Peff
Previous: Raúl Núñez de Arenas CoronadoNext: Raúl Núñez de Arenas Coronado
Message 13 of 14 in “Fwd: Unexpected behavior of ls-files command when using --others --exclude-from, and a .gitignore file which resides in a subdirectory”
  1. Raúl Núñez de Arenas CoronadoJan 22, 2024
  2. Junio C HamanoJan 22, 2024
  3. Raúl Núñez de Arenas CoronadoJan 22, 2024
  4. Junio C HamanoJan 22, 2024
  5. Raúl Núñez de Arenas CoronadoJan 23, 2024
  6. Jeff KingJan 22, 2024
  7. Junio C HamanoJan 22, 2024
  8. Jeff KingJan 22, 2024
  9. Elijah NewrenJan 24, 2024
  10. Junio C HamanoJan 24, 2024
  11. Jeff KingJan 24, 2024
  12. Raúl Núñez de Arenas CoronadoJan 23, 2024
  13. Jeff KingJan 24, 2024
  14. Raúl Núñez de Arenas CoronadoJan 24, 2024

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.