Re: Fwd: Unexpected behavior of ls-files command when using --others --exclude-from, and a .gitignore file which resides in a subdirectory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 22, 2024, 20:52 UTC
- Message-ID
- <xmqqfryprsyp.fsf@gitster.g>
- In-Reply-To
- <CAGF1KhWiYX=3R01Odj2yCNgvx=f5+HRCjRJogWf5eBikuATCcg@mail.gmail.com>
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/1in such a repository? The "--exclude-from" option is used to name the contents (set of patterns) that should be used and the path of the file that happens to contain the contents does not matter. So you should get the same output as the ls-files command that was told to use "--exclude-from=subdir/.gitignore".