From 454f079852deb0c704870c7d5a462485f1e65bbf Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 13 May 2015 15:24:28 +0200 Subject: 35101: completion: git: add __git_commit_objects_prefer_recent 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(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 92835387d..d64e777e8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5600,6 +5600,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., @@ -5610,7 +5615,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] )) || -- cgit v1.2.3