Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] _git: Apply matchspecs to filename completion such as 'git log f/b<TAB>' → 'foo/bar.txt's



This patch makes 'git log S/e<TAB>' expand to Src/exec.c.  The incumbent
code would run 'git ls-tree S/' and find no matches.
---
I realize this makes the output size O(tree) (index lookups, not
readdir()s).  If this turns out to be a problem for larger repositories,
I assume either the listing could be made smarter (list the tree to a more
limited depth or breadth) or the result cached.

 Completion/Unix/Command/_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 719d717..ecf3fcb 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6071,7 +6071,7 @@ __git_tree_files () {
   shift
   (( at_least_one_tree_added = 0 ))
   for tree in $*; do
-    tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z $tree $Path 2>/dev/null)"})
+    tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r $extra_args --name-only -z $tree 2>/dev/null)"})
     __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 ))
   done
 
-- 
2.1.4



Messages sorted by: Reverse Date, Date, Thread, Author