Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/2] _git-checkout: When completing local heads, prefer recently-checked-out ones. (after 38592)
- X-seq: zsh-workers 40818
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/2] _git-checkout: When completing local heads, prefer recently-checked-out ones. (after 38592)
- Date: Fri, 10 Mar 2017 09:05:17 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=x3BWXAlPgG7uiphmZFr6dHlVUlM=; b=Pqy3gt/QS0Len0lag1Yce bgaxv4N4GBuOTKBBWbQ27Iu3v3iETrbcLfEUsYlDDM00VUhRs7lZ2c5Eyo0/Uw7H X/QeBywr4dPCyIub/LtzCVA5Uq2gqz3R2KZl/NcSl+/UiGV3QtZ+4aG0wlDkI8tP Ig/476UW3HyLLZZEpRF4Ko=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=x3BWXAlPgG7uiphmZFr6dHlVUlM=; b=sX7eiKQS6bIEqQz7e7kK 5mU90Qo0cqMTfLIOWGQ2lcnMfJCpxzBgVr6YL5LMRfyVcpHX6wJIR2l9gSPKLoRd UwKcITWnJo4Qha0eCb3v1nZ7j4HqXUCDTISoUuOWyge2dYjm/eI3W5/zXJaQ4Y1h Px0AyrEdD/ogH2vO+zj6c0o=
- In-reply-to: <1489136717-8280-1-git-send-email-danielsh@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1489136717-8280-1-git-send-email-danielsh@fujitsu.shahaf.local2>
---
This changes the completion of local branch names at «git checkout <TAB>»
by finally hooking up the code written in 38592 by default.
In my experience, the cold cache behaviour was sometimes a bit slow. If
others see this too then perhaps the 'depth' constant down in
__git_recent_branches should be reduced?
Cheers,
Daniel
Completion/Unix/Command/_git | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 73daedc..85aac92 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 () {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author