1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 00:31:07 +02:00

Mikael Magnusson: 24396: don't pass -r to git ls-files for performance reasons, compensate for lack of recursion.

This commit is contained in:
Clint Adams 2008-01-22 01:18:47 +00:00
parent 172a81db90
commit 898111026d
2 changed files with 21 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2008-01-22 Clint Adams <clint@zsh.org>
* Mikael Magnusson: 24396: Completion/Unix/Command/_git:
don't pass -r to git ls-files for performance reasons,
compensate for lack of recursion.
2008-01-21 Wayne Davison <wayned@users.sourceforge.net> 2008-01-21 Wayne Davison <wayned@users.sourceforge.net>
* unposted: Src/builtin.c: got rid of compiler warning about * unposted: Src/builtin.c: got rid of compiler warning about

View file

@ -825,12 +825,12 @@ _git-diff-tree () {
# new tree: # new tree:
# ... # ...
_alternative \ _alternative \
"original tree:original tree:__git_tree_files $line[1]" \ "original tree:original tree:__git_tree_files . $line[1]" \
"new tree:new tree:__git_tree_files $line[2]" && ret=0 "new tree:new tree:__git_tree_files . $line[2]" && ret=0
else else
_alternative \ _alternative \
': :__git_tree_ishs' \ ': :__git_tree_ishs' \
": :__git_tree_files $line[1]" && ret=0 ": :__git_tree_files . $line[1]" && ret=0
fi fi
;; ;;
esac esac
@ -923,7 +923,7 @@ _git-ls-tree () {
case $state in case $state in
files) files)
__git_tree_files $line[1] && ret=0 __git_tree_files . $line[1] && ret=0
;; ;;
esac esac
} }
@ -1365,7 +1365,7 @@ _git-archive () {
case $state in case $state in
(files) (files)
__git_tree_files $line[1] && ret=0 __git_tree_files . $line[1] && ret=0
;; ;;
esac esac
} }
@ -1503,7 +1503,7 @@ _git-checkout () {
case $state in case $state in
(files) (files)
if [[ -n $line[1] ]]; then if [[ -n $line[1] ]]; then
__git_tree_files $line[1] && ret=0 __git_tree_files . $line[1] && ret=0
else else
__git_cached_files && ret=0 __git_cached_files && ret=0
fi fi
@ -1689,13 +1689,13 @@ _git-grep () {
else else
_alternative \ _alternative \
'tree:tree:__git_trees' \ 'tree:tree:__git_trees' \
"tree file:tree-files:__git_tree_files $line[first_tree,last_tree]" && ret=0 "tree file:tree-files:__git_tree_files . $line[first_tree,last_tree]" && ret=0
fi fi
else else
if (( first_tree == 0 )); then if (( first_tree == 0 )); then
__git_cached_files __git_cached_files
else else
__git_tree_files $line[first_tree,last_tree] __git_tree_files . $line[first_tree,last_tree]
fi fi
fi fi
;; ;;
@ -1835,7 +1835,7 @@ _git-reset () {
if [[ $words[2] == --mixed ]]; then if [[ $words[2] == --mixed ]]; then
commit_arg=':commit:__git_revisions' commit_arg=':commit:__git_revisions'
path_arg="*:file:__git_tree_files $words[3]" path_arg="*:file:__git_tree_files . $words[3]"
else else
commit_arg='::commit:__git_revisions' commit_arg='::commit:__git_revisions'
fi fi
@ -2558,7 +2558,7 @@ __git_command_successful () {
__git_objects () { __git_objects () {
compset -P '*:' compset -P '*:'
if [[ -n $IPREFIX ]]; then if [[ -n $IPREFIX ]]; then
__git_tree_files ${IPREFIX%:} __git_tree_files "$PREFIX" "${IPREFIX%:}"
else else
_alternative \ _alternative \
'revisions:revision:__git_revisions' \ 'revisions:revision:__git_revisions' \
@ -2651,13 +2651,16 @@ __git_tree_files () {
zparseopts -D -E -a multi_parts_opts M: J: V: 1 2 n F: X: zparseopts -D -E -a multi_parts_opts M: J: V: 1 2 n F: X:
local tree local tree Path
integer at_least_one_tree_added integer at_least_one_tree_added
local -a tree_files local -a tree_files
Path=${1%/*}/
[[ $Path = / ]] && Path=.
shift
(( at_least_one_tree_added = 0 )) (( at_least_one_tree_added = 0 ))
for tree in $*; do for tree in $*; do
tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z -r $tree 2>/dev/null)"}) tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z $tree $Path 2>/dev/null)"})
__git_command_successful && (( at_least_one_tree_added = 1 )) __git_command_successful && (( at_least_one_tree_added = 1 ))
done done