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. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f96c27d2e..685575c05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,11 @@ Handle " -> master, origin/master" in decorated git-log output, and add it as separate entries. + * 35101: Completion/Unix/Command/_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. + 2015-05-16 Daniel Shahaf * 35161: Completion/Unix/Command/_git: completion: git: Fix 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 1.4.1