From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1479 invoked by alias); 5 Feb 2017 09:15:16 -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: 40493 Received: (qmail 6830 invoked from network); 5 Feb 2017 09:15:16 -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 1.191157 secs); 05 Feb 2017 09:15:16 -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-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=A1oLSkz7QOuPvkJgsgIYE3i7ok0=; b=tLnfo9 1wns1ZWwjNnWkbz9wHr0moCXucPo+omLX22ASBut+mGSM1FbZMOIBXVIjOksUlpA ZAlqS5xC7fPdMDziDR53c349lbFh40dfUjHmoGg/CiLfInAZiLo06rDhJhcSQXyN uSFgewvI60CFGnxOjt+vXt0tz5frSEzX3V64E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=A1oLSkz7QOuPvkJgsgIYE3i7ok0=; b=B7Rfk PMrAzpbMN/aBj2vZ0CjESleRpGbrXXcyhTq07yxBc0HBBTYo5PMMWQWhnEtkhS2r yBiC33W/jAX68R+/Rlmz0KCUD3xO8gxI3CvPqxdnFxwNioksmntTHdcvvAXP9m/B m8HgUESCrwqZt7Us8/pjsuIsZjQ7unB7CFz3zA= X-ME-Sender: X-Sasl-enc: 6Kmg4OdHwxRqXBFoMz4bH530JoZ2cElqf6WbA27afNyj 1486286111 Date: Sun, 5 Feb 2017 09:11:05 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] _git-checkout: Reorder default completions. Message-ID: <20170205091105.GA20317@fujitsu.shahaf.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="W/nzBZO5zC0uMSeA" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) --W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline A quick series to change the order of alternatives in 'git checkout '. I realize it's somewhat of a bikeshed, but on the other hand, I'd like to have good defaults. Cheers, Daniel --W/nzBZO5zC0uMSeA Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-_git-checkout-No-functional-change.patch" >>From c7a91ce338a3a0c2245bc79e892f10e3fc28cc1a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 28 Jul 2016 12:25:52 +0000 Subject: [PATCH 1/2] _git-checkout: No functional change. This makes the next diff smaller. --- Completion/Unix/Command/_git | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b5b3e79..8b78b57 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -473,28 +473,24 @@ _git-checkout () { [[ $line[CURRENT] = -* ]] && return if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B - local branch_arg='' \ + local \ remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ tree_ish_arg='tree-ishs::__git_tree_ishs' \ file_arg='modified-files::__git_modified_files' if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then - remote_branch_noprefix_arg= - file_arg= + _alternative $tree_ish_arg && ret=0 elif [[ -n $opt_args[(I)--track] ]]; then - branch_arg='remote-branches::__git_remote_branch_names' - remote_branch_noprefix_arg= - tree_ish_arg= - file_arg= + _alternative remote-branches::__git_remote_branch_names && ret=0 elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]]; then - remote_branch_noprefix_arg= + _alternative $tree_ish_arg $file_arg && ret=0 + else + _alternative \ + $remote_branch_noprefix_arg \ + $tree_ish_arg \ + $file_arg && ret=0 fi - _alternative \ - $branch_arg \ - $remote_branch_noprefix_arg \ - $tree_ish_arg \ - $file_arg && ret=0 elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then _nothing elif [[ -n $line[1] ]] && __git_is_treeish $line[1]; then --W/nzBZO5zC0uMSeA Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0002-_git-checkout-Reorder-default-completions.patch" >>From da2fffa6076bf4b4ff7d6dc22c1b8ec2cea8a045 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 28 Jul 2016 12:37:14 +0000 Subject: [PATCH 2/2] _git-checkout: Reorder default completions. The unprefixed name of a remote branch is used to create a new local remote-tracking branch; that is presumed to be a rarer operation than either switching among local branches or reverting to the index version of a modified file. Between the remaining two, put modified files before tree-ishes because there are generally few of the former and many of the latter. --- Completion/Unix/Command/_git | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8b78b57..b16d2bc 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -486,9 +486,10 @@ _git-checkout () { _alternative $tree_ish_arg $file_arg && ret=0 else _alternative \ - $remote_branch_noprefix_arg \ + $file_arg \ $tree_ish_arg \ - $file_arg && ret=0 + $remote_branch_noprefix_arg \ + && ret=0 fi elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then --W/nzBZO5zC0uMSeA--