{"thread":{"id":"58087","subject":"let git-ls-files suppress the expanding of all files in sub directory","startedAt":"2022-06-30T06:14:19Z","lastAt":"2022-06-30T23:50:08Z","messageCount":3,"participants":["lilinchao@oschina.cn","Erik Cervin Edin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"458160","messageId":"202206281608475079493@oschina.cn","threadId":"58087","inReplyTo":null,"subject":"let git-ls-files suppress the expanding of all files in sub directory","fromName":"lilinchao@oschina.cn","fromEmail":"lilinchao@oschina.cn","sentAt":"2022-06-30T06:14:04Z","receivedAt":"2022-06-30T06:14:19Z","isPatch":false,"sender":{"key":"lilinchao@oschina.cn","avatar":null},"body":"As subject said, is this possible for git-ls-files to work like this?:\n\" $ git ls-files --no-recursion\n    a.txt\n    b.txt\n    dir/\n\"\ninstead of:\n\" $ git ls-files \n    a.txt\n    b.txt\n    dir/one/two/1.txt\n    dir/one/two/2.txt\n    dir/one/3.txt\n    dir/4.txt\n\"\n\nDoes it make sense?"},{"id":"458290","messageId":"CA+JQ7M_rd_SdzLOL=a0ok=HL9AZ-q=V2Bc2aTuLRrPW8j7DOqA@mail.gmail.com","threadId":"58087","inReplyTo":"202206281608475079493@oschina.cn","subject":"Re: let git-ls-files suppress the expanding of all files in sub directory","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-06-30T23:04:21Z","receivedAt":"2022-06-30T23:05:05Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"On Thu, Jun 30, 2022, 8:26 AM lilinchao@oschina.cn <lilinchao@oschina.cn> wrote:\n>\n> As subject said, is this possible for git-ls-files to work like this?:\n> \" $ git ls-files --no-recursion\n>     a.txt\n>     b.txt\n>     dir/\n> \"\n\nAn alternative\n  git ls-tree --name-only HEAD\nis suggested here\nhttps://stackoverflow.com/a/10453994\n\nMaybe that works?\n"},{"id":"458310","messageId":"xmqqv8shaf0v.fsf@gitster.g","threadId":"58087","inReplyTo":"CA+JQ7M_rd_SdzLOL=a0ok=HL9AZ-q=V2Bc2aTuLRrPW8j7DOqA@mail.gmail.com","subject":"Re: let git-ls-files suppress the expanding of all files in sub directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-06-30T23:49:04Z","receivedAt":"2022-06-30T23:50:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Cervin Edin <erik@cervined.in> writes:\n\n> On Thu, Jun 30, 2022, 8:26 AM lilinchao@oschina.cn <lilinchao@oschina.cn> wrote:\n>>\n>> As subject said, is this possible for git-ls-files to work like this?:\n>> \" $ git ls-files --no-recursion\n>>     a.txt\n>>     b.txt\n>>     dir/\n>> \"\n>\n> An alternative\n>   git ls-tree --name-only HEAD\n> is suggested here\n> https://stackoverflow.com/a/10453994\n\nThe index may have different contents from HEAD, so it won't be a\nreplacement in general.\n\nThe index is a flat list of paths, so it is not like you can\nsuppressing the expansion (to avoid extra work).  You have to do\nmore work to omit paths in subdirectories to create such output.\n\n"}]}