Skip to content
Myr

Tip on using git ls-tree (#31)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 7d15071 · Browse files · 1 file+20 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−0 removed

  • other:+20 added−0 removed

1 file+20 added−0 removed

modified:README.md+20 added
456 unmodified lines
457# Now fzf (w/o pipe) will use ag instead of find458fzf459```460461### `git ls-tree` for fast traversal462463If you're running fzf in a large git repository, `git ls-tree` can boost up the464speed of the traversal.465466```sh467# Copy the original fzf function to __fzf468declare -f __fzf > /dev/null ||469 eval "$(echo "__fzf() {"; declare -f fzf | grep -v '^{' | tail -n +2)"470471# Use git ls-tree when possible472fzf() {473 if [ -n "$(git rev-parse HEAD 2> /dev/null)" ]; then474 FZF_DEFAULT_COMMAND="git ls-tree -r --name-only HEAD" __fzf "$@"475 else476 __fzf "$@"477 fi478}479```480481### Fish shell482483It's [a known bug of fish](https://github.com/fish-shell/fish-shell/issues/1362)484that it doesn't allow reading from STDIN in command substitution, which means
36 unmodified lines