Skip to contentSkip to conversation

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

DISCUSSION [email protected] 3 participants 3 messages Jun 30, 2022

lore
Share & tools
lore
#0 lore raw

As subject said, is this possible for git-ls-files to work like this?:
" $ git ls-files --no-recursion
    a.txt
    b.txt
    dir/
"
instead of:
" $ git ls-files
    a.txt
    b.txt
    dir/one/two/1.txt
    dir/one/two/2.txt
    dir/one/3.txt
    dir/4.txt
"

Does it make sense?

#2 lore raw
Quoted 9 lines · Erik Cervin Edin
Quoted 7 lines · On Thu, Jun 30, 2022, 8:26 AM [email protected] <[email protected]> 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/
"

Quoted 4 lines

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.