From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id a5db6e43 for ; Mon, 25 Feb 2019 10:05:15 +0000 (UTC) Received: (qmail 9670 invoked by alias); 25 Feb 2019 10:05:04 -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: List-Unsubscribe: X-Seq: 44082 Received: (qmail 25034 invoked by uid 1010); 25 Feb 2019 10:05:03 -0000 X-Qmail-Scanner-Diagnostics: from hahler.de by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25370. spamassassin: 3.4.2. Clear:RC:0(188.40.33.212):SA:0(-1.9/5.0):. Processed in 0.905349 secs); 25 Feb 2019 10:05:03 -0000 X-Envelope-From: genml+zsh-workers@thequod.de X-Qmail-Scanner-Mime-Attachments: |signature.asc| X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.hahler.de designates 188.40.33.212 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:subject:subject :received:received; s=postfix2; t=1551089069; bh=5jiu0fQkp8pbTcc 3K0kgfsFjV46AmESEX+uPkvWMMZg=; b=j+4XD0ji+XVq09+3dsFp9eGaiXCIR7N xZ8Y+qxx8/Mkv7Bb539WdE+KIVJUGWRCYUFhF+m1G2W84C8ZI+ykpEQQJAUQ8Qx4 My5YjF8sPmpSNfE+38yNWSLD+iHZKoSkY1ju38a3ADBANoNdpVr4fWaZEAiEU/kh d3XVPSRthTaE= Subject: Re: RFC: [PATCH] Completion/Unix/Command/_git: replace a few "*::" with "*:" To: Zsh Hackers' List References: <20190224135854.3905-1-genml+zsh-workers@thequod.de> <57F7B086-B935-4E12-8FEA-A2F232EEDB43@dana.is> From: Daniel Hahler Openpgp: preference=signencrypt Autocrypt: addr=genml+zsh-workers@thequod.de; prefer-encrypt=mutual; keydata= mQGiBD8qj1kRBADEu95hD1Vv3GOIAsmxWMdWwM3acuDfFdRMX/7mB84yU3/GzC4aRCDi/ZS9 3dQgM9gInU1IrrXQrDCWzMzRR4e/9/1aIwUGI1tWzulfae5NphVMQLtwH9tuqAXCo8HrdS+l BccHK16KflMfIr4HHhANeO+52oRa459LxsFkXghJEwCg/4IpXFnmzREFiRPToiUiOeJvej8E AJMqdc/2XeERJ0R7ZOtp7Md+P+JGsgbSgGEttVzDWSZq5sg9XZxhy+qxr+IH4AaTYc0ZPDEp ba1fKyiU9ksrNVJCoj9cJpLZ6DexQ6bDttLXBXIf17Yk4tYjvIpGEW3un+xz+XyDgnQ8cryY +i3EGgRnM2isYDaaJr49FhnwvMu0A/9VTaEqNBs2MgOFIkJ6/w8kvukYYma7DP0UeU7LXDfF 4Cr9lV3mQAb73Lzp1SEpWfVSAfxfU5ZAGiRhb3t6atzt7Kx07f6e7I5SeSAoksMX9QAiZO+1 bcJtKUYX2edrzSQwHhQkJdE7R+22II+DotobG1IG32938PWYhsplrZ3IebQgZEFuaWVsIGhB aGxlciA8Z2VubWxAdGhlcXVvZC5kZT6IfgQTEQoAPgIbAwIeAQIXgAULCQgHAwUVCgkICwUW AgMBABYhBLWmwiCCn65daeuco3wCv4U/5j4ABQJZaPVpBQkeAM0QAAoJEHwCv4U/5j4ADZcA n0Nts06IgGs0iDip80E8sHt/NJB1AJ94BoTf2uyiatsMWyQHCfvZRFPhb7kCDQQ/Ko9qEAgA 5/Cj+ol5RGHn7VI3Sy2AyDoKMJhQeP4sBNC7jQaW+Lcsit/ycWNqTalLq3GhKfRr8ub+oMku xvQBUt6BqKT9MoVHRs5ir6Exqu0FucVUUteUYsMwIMtqrbr3ZrlWShtC1qVt4JFEfUuxbt8G 3H6DfwXUzq5N/xoRnoFS0IqASIIHwQKl/Un2R481K4PX2WW99tt+2PPjPPt+aeK5ExgB7wnz syQ1Zb3DJqaFFlj4IZHepIEOPI15sAp0lTVMtU0NeXFEwfqeZkPeLL/VNuhEEGPSGA/mR80n GiYBENNbhf1BOor6Ow7EmcN1Rui+Y6naUA5t5Uw3Zjlg42ptToPnFwACAgf/Wr7W7h6qBbwX a+LKGpkYLTZ/8ePJ5zHQc2GYU4P5dd1pQSjmNr8Nn9JElMLXubaBXdrJg+dl6pK6+vKFD9La xG+5tMAw2uOHdmAkguMKg4s6oD6spkGVNEcuAgLqDYrvT2nUfoAsHPn2jaDrkLA3h3prVn/J jH1jG9tbqnmI7BBDyw41IiB0YLFtCEtLkhu/h5Jrih42XZVNnteMmfaz8J5XlWSa2WiSGM9S eveYzwpIuqvvO1QHP0NTKq5PtxyKLqhh4bnP9hMFodIvMWk/YhFly7M8sUbiPPBf8l3n5i3S Q7inn81hQh/6QeULuGKl8Wfj3w8h3MxqvD16yeb/yIhjBBgRCgAjFiEEtabCIIKfrl1p65yj fAK/hT/mPgAFAllo9Y0FCR4AzSMACgkQfAK/hT/mPgDJrQCgmKNv5SdquTcN2dDy1xT8Oovu A+IAn2ln6X+jrfnVCrxedrx1acYhQpXH Message-ID: Date: Mon, 25 Feb 2019 11:04:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oE7kuuOM4RVGEpnUIbjcOXpENKwOxDf6b" --oE7kuuOM4RVGEpnUIbjcOXpENKwOxDf6b Content-Type: multipart/mixed; boundary="iBBST8JetNYB3tkqJhHqX5xhdZ7fJmZ52"; protected-headers="v1" From: Daniel Hahler To: Zsh Hackers' List Message-ID: Subject: Re: RFC: [PATCH] Completion/Unix/Command/_git: replace a few "*::" with "*:" References: <20190224135854.3905-1-genml+zsh-workers@thequod.de> <57F7B086-B935-4E12-8FEA-A2F232EEDB43@dana.is> In-Reply-To: --iBBST8JetNYB3tkqJhHqX5xhdZ7fJmZ52 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 25.02.19 10:46, Daniel Hahler wrote: > What about something like this (against master)? As for _git_checkout, the following appears to work better: Completion/Unix/Command/_git | 54 ++++++++++++++++++++------------------= ------ 1 file changed, 25 insertions(+), 29 deletions(-) diff --git i/Completion/Unix/Command/_git w/Completion/Unix/Command/_git index b3e54f7f9..e9f6f3587 100644 --- i/Completion/Unix/Command/_git +++ w/Completion/Unix/Command/_git @@ -449,7 +449,7 @@ _git-checkout () { local curcontext=3D$curcontext state line ret=3D1 declare -A opt_args =20 - _arguments -C -s \ + _arguments -C -s -S \ '(-q --quiet --progress)'{-q,--quiet}'[suppress progress reporting]'= \ '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force bran= ch switch/ignore unmerged entries]' \ '(-q --quiet -2 --ours -3 --theirs --patch)'{-2,--ours}'[check out s= tage #2 for unmerged paths]' \ @@ -469,37 +469,33 @@ _git-checkout () { '--recurse-submodules=3D-[control recursive updating of submodules]:= :checkout:__git_commits' \ '(-q --quiet)--progress[force progress reporting]' \ '(-)--[start file arguments]' \ - '*:: :->branch-or-tree-ish-or-file' && ret=3D0 + '1: :->first-arg' \ + '*: :->other-arg' && ret=3D0 =20 case $state in - (branch-or-tree-ish-or-file) - # TODO: Something about *:: brings us here when we complete at "-"= =2E I - # guess that this makes sense in a way, as we might want to treat = it as - # an argument, but I can't find anything in the documentation abou= t this - # behavior. - [[ $line[CURRENT] =3D -* ]] && return - if (( CURRENT =3D=3D 1 )) && [[ -z $opt_args[(I)--] ]]; then - # TODO: Allow A...B - local \ - remote_branch_noprefix_arg=3D'remote-branch-names-noprefix= ::__git_remote_branch_names_noprefix' \ - tree_ish_arg=3D'tree-ishs::__git_commits_prefer_recent' \ - file_arg=3D'modified-files::__git_modified_files' + (first-arg) + # TODO: Allow A...B + local \ + remote_branch_noprefix_arg=3D'remote-branch-names-noprefix::__git_r= emote_branch_names_noprefix' \ + tree_ish_arg=3D'tree-ishs::__git_commits_prefer_recent' \ + file_arg=3D'modified-files::__git_modified_files' =20 - if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then - _alternative $tree_ish_arg && ret=3D0 - elif [[ -n $opt_args[(I)--track] ]]; then - _alternative remote-branches::__git_remote_branch_names && ret= =3D0 - elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]}= ]]; then - _alternative $tree_ish_arg $file_arg && ret=3D0 - else - _alternative \ - $file_arg \ - $tree_ish_arg \ - $remote_branch_noprefix_arg \ - && ret=3D0 - fi - - elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; = then + if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then + _alternative $tree_ish_arg && ret=3D0 + elif [[ -n $opt_args[(I)--track] ]]; then + _alternative remote-branches::__git_remote_branch_names && ret=3D0 + elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]= ]; then + _alternative $tree_ish_arg $file_arg && ret=3D0 + else + _alternative \ + $file_arg \ + $tree_ish_arg \ + $remote_branch_noprefix_arg \ + && ret=3D0 + fi + ;; + (other-arg) + if [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; th= en _nothing elif [[ -n $line[1] ]] && __git_is_treeish ${(Q)line[1]}; then __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Q)line[1]} &&= ret=3D0 --iBBST8JetNYB3tkqJhHqX5xhdZ7fJmZ52-- --oE7kuuOM4RVGEpnUIbjcOXpENKwOxDf6b Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQS1psIggp+uXWnrnKN8Ar+FP+Y+AAUCXHO9pgAKCRB8Ar+FP+Y+ ANAFAJ9PRrWxHYmOdc8k5c2SzHMMIqMYqACg3mb0zgakn5MUOAS5FL/31T5aiZU= =K9dH -----END PGP SIGNATURE----- --oE7kuuOM4RVGEpnUIbjcOXpENKwOxDf6b--