about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-03-10 09:05:17 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-03-14 11:14:14 +0000
commite869952200852a414debc6475a652e04e3b03641 (patch)
treec8bf5f946f1a13ec6fb2f17d8004374366bc4998
parent46233c40204756df3a927cab3b429df54f8e3d8c (diff)
downloadzsh-e869952200852a414debc6475a652e04e3b03641.tar.gz
zsh-e869952200852a414debc6475a652e04e3b03641.tar.xz
zsh-e869952200852a414debc6475a652e04e3b03641.zip
40818: _git-checkout: When completing local heads, prefer recently-checked-out ones. (after 38592)
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_git6
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 221967fc0..1a6d16546 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-03-14  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 40818: Completion/Unix/Command/_git: _git-checkout: When
+	completing local heads, prefer recently-checked-out ones. (after
+	38592)
+
 	* 40817: Completion/Unix/Command/_git: __git_recent_branches:
 	Retrieve less data, but faster.
 
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 73daedcc9..85aac9264 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -476,7 +476,7 @@ _git-checkout () {
         # TODO: Allow A...B
         local \
               remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \
-              tree_ish_arg='tree-ishs::__git_tree_ishs' \
+              tree_ish_arg='tree-ishs::__git_commits_prefer_recent' \
               file_arg='modified-files::__git_modified_files'
 
         if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then
@@ -6169,6 +6169,10 @@ __git_recent_branches() {
   _describe -V -t recent-branches "recent branches" branches_colon_descriptions
 }
 
+(( $+functions[__git_commits_prefer_recent] )) ||
+__git_commits_prefer_recent () {
+  _alternative 'recent-branches::__git_recent_branches' 'commits::__git_commits'
+}
 
 (( $+functions[__git_commits] )) ||
 __git_commits () {