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

[PATCH 3/7] completion: git: add __git_commit_objects_prefer_recent



From: Daniel Hahler <git@xxxxxxxxxx>

This is used with __git_commits then, and is meant to only call
__git_recent_commits, if there are matches.
---
 Completion/Unix/Command/_git | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 2204fc8..b590df0 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5599,6 +5599,11 @@ __git_remote_branch_names_noprefix () {
   _wanted remote-branch-names-noprefix expl 'remote branch name' compadd "$@" -a - branch_names
 }
 
+(( $+functions[__git_commit_objects_prefer_recent] )) ||
+__git_commit_objects_prefer_recent () {
+  __git_recent_commits || __git_commit_objects
+}
+
 (( $+functions[__git_commits] )) ||
 __git_commits () {
   # TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
@@ -5609,7 +5614,7 @@ __git_commits () {
   _alternative \
     "heads::__git_heads $sopts" \
     "commit-tags::__git_commit_tags $sopts" \
-    'commit-objects::__git_commit_objects'
+    'commit-objects::__git_commit_objects_prefer_recent'
 }
 
 (( $+functions[__git_heads] )) ||
-- 
2.4.0.dirty



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