Subject: Re: [PATCH] completion: improve untracked directory filtering for filename completion

From: Jonathan Nieder <[email-masked]>
Date: Thu, 19 Sep 2013 12:31:10 -0700

SZEDER Gábor wrote:

>   $ time __git_index_files "--others --modified"
>   untracked-dir
>
>   real	0m0.537s
>   user	0m0.452s
>   sys	0m0.160s
>
> Eliminate this delay by additionally passing the '--directory
> --no-empty-directory' options to 'git ls-files' to show only the
> directory name of non-empty untracked directories instead their whole
> content:
>
>   $ time __git_index_files "--others --modified --directory --no-empty-directory"
>   untracked-dir
>
>   real	0m0.029s
>   user	0m0.020s
>   sys	0m0.004s

Nice.  This is what "git status" uses, too.

> Filename completion for 'git clean' suffers from the same delay, as it
> offers untracked files, too.  The fix could be the same, but since it
> actually makes sense to 'git clean' empty directories, in this case we
> only pass the '--directory' option to 'git ls-files'.

Also sensible.

For what it's worth,
Reviewed-by: Jonathan Nieder <[email-masked]>