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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 30, 2022, 23:49 UTC
Message-ID
<xmqqv8shaf0v.fsf@gitster.g>
In-Reply-To
<CA+JQ7M_rd_SdzLOL=a0ok=HL9AZ-q=V2Bc2aTuLRrPW8j7DOqA@mail.gmail.com>
Erik Cervin Edin <erik@cervined.in> writes:
Show 13 quoted lines
> On Thu, Jun 30, 2022, 8:26 AM lilinchao@oschina.cn <lilinchao@oschina.cn> 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.

Previous: Erik Cervin Edin
Message 3 of 3 in “let git-ls-files suppress the expanding of all files in sub directory”
  1. lilinchao@oschina.cnJun 30, 2022
  2. Erik Cervin EdinJun 30, 2022
  3. Junio C HamanoJun 30, 2022

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.