From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10599 invoked by alias); 10 Mar 2017 09:10:27 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40818 Received: (qmail 17021 invoked from network); 10 Mar 2017 09:10:27 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-0.7/5.0):. Processed in 0.365505 secs); 10 Mar 2017 09:10:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) 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= X-ME-Sender: X-Sasl-enc: jGkKLvZ/DFPTUMXljyIckrVEV9uPjXGnwrH+zRuGOxRy 1489137024 From: Daniel Shahaf To: zsh-workers@zsh.org 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 Message-Id: <1489136717-8280-2-git-send-email-danielsh@fujitsu.shahaf.local2> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1489136717-8280-1-git-send-email-danielsh@fujitsu.shahaf.local2> References: <1489136717-8280-1-git-send-email-danielsh@fujitsu.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- This changes the completion of local branch names at «git checkout » 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 () {