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
Raúl Núñez de Arenas Coronado <raulnac@gmail.com>
Date
Jan 22, 2024, 21:07 UTC
Message-ID
<CAGF1KhU=o2rb-tCjZAG278kgoW50NYymsJakUwiMxWTQ33gQYA@mail.gmail.com>
In-Reply-To
<xmqqfryprsyp.fsf@gitster.g>
Hi Junio, and thanks a lot for your reply :)
El lun, 22 ene 2024 a las 21:52, Junio C Hamano (<gitster@pobox.com>) escribió:
Show 13 quoted lines
> Raúl Núñez de Arenas Coronado <raulnac@gmail.com> writes:
>
> > In short: using 'git ls-files --others
> > --exclude-from=subdir/.gitignore' results in an empty listing if
> > subdir/.gitignore contains '*". IMHO that pattern should be applied to
> > the subdir contents ...
>
> I do not think so.
>
> Imagine what would happen then if you did
>
>     $ cp subdir/.gitignore /var/tmp/1
>     $ git ls-files --others --exclude-from=/var/tmp/1

I understand this use case, yes. I was thinking about what git itself does when ignoring files, especially when dealing with .gitgnore files in subdirectories, but clearly this needs a different policy, yes.

What I needed from this command is a way of backing up some ignored files. These files should not go into the repository, but I'm using them temporarily for development so it is a good idea to back them up. I'll just backup the entire repository instead, is not a big deal :))

Again, thanks for your reply and your explanation! It's a huge honor to be replied to by no less than the Git team leather!

-- 
Raúl Núñez de Arenas Coronado
.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 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.