Subject: Re: let git-ls-files suppress the expanding of all files in sub directory

From: Junio C Hamano <[email-masked]>
Date: Thu, 30 Jun 2022 16:49:04 -0700

Erik Cervin Edin <[email-masked]> writes:

> On Thu, Jun 30, 2022, 8:26 AM [email-masked] <[email-masked]> wrote:
>>
>> As subject said, is this possible for git-ls-files to work like this?:
>> " $ git ls-files --no-recursion
>>     a.txt
>>     b.txt
>>     dir/
>> "
>
> An alternative
>   git ls-tree --name-only HEAD
> is suggested here
> https://stackoverflow.com/a/10453994

The index may have different contents from HEAD, so it won't be a
replacement in general.

The index is a flat list of paths, so it is not like you can
suppressing the expansion (to avoid extra work).  You have to do
more work to omit paths in subdirectories to create such output.