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 4928b2c9 for ; Mon, 25 Feb 2019 09:47:00 +0000 (UTC) Received: (qmail 9718 invoked by alias); 25 Feb 2019 09:46:43 -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: 44081 Received: (qmail 27332 invoked by uid 1010); 25 Feb 2019 09:46:43 -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 2.556192 secs); 25 Feb 2019 09:46:43 -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=1551087964; bh=ysQRGXYWRF4iXDw rxJogBAnO53X3DdikObIyvWsvDaE=; b=ngpGYtErh0YAdR7INFoP7jN4CHXVk11 Usff3HaPy6WuZ2gIe3e57toCtUHSl0h8Pb5VTi9NVZFQHHTGkAfoeYCeHs5Ynw8d hwR8qBCBZEKu1WbXx5W7iSIfLUU8fC1fQwNx0HPvIFkxjROHPeQheCb6v7Sv6WPD zjlODtOYmkyg= Subject: Re: RFC: [PATCH] Completion/Unix/Command/_git: replace a few "*::" with "*:" To: dana Cc: zsh-workers@zsh.org 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+DotobG1IG32938PWYhsplrZ3IebQeRGFuaWVsIEhh aGxlciA8cGdwQHRoZXF1b2QuZGU+iIEEExEKAEECGwMCHgECF4ACGQEFCwkIBwMFFQoJCAsF FgIDAQAWIQS1psIggp+uXWnrnKN8Ar+FP+Y+AAUCWWj1aQUJHgDNEAAKCRB8Ar+FP+Y+APZt AJ4mA1Db8pe/O5u1h6VdGgQKdjhXgQCg7+MICeEkTwseMpeey5kl1RTdudG5Ag0EPyqPahAI AOfwo/qJeURh5+1SN0stgMg6CjCYUHj+LATQu40Glvi3LIrf8nFjak2pS6txoSn0a/Lm/qDJ Lsb0AVLegaik/TKFR0bOYq+hMartBbnFVFLXlGLDMCDLaq2692a5VkobQtalbeCRRH1LsW7f Btx+g38F1M6uTf8aEZ6BUtCKgEiCB8ECpf1J9kePNSuD19llvfbbftjz4zz7fmniuRMYAe8J 87MkNWW9wyamhRZY+CGR3qSBDjyNebAKdJU1TLVNDXlxRMH6nmZD3iy/1TboRBBj0hgP5kfN JxomARDTW4X9QTqK+jsOxJnDdUbovmOp2lAObeVMN2Y5YONqbU6D5xcAAgIH/1q+1u4eqgW8 F2viyhqZGC02f/Hjyecx0HNhmFOD+XXdaUEo5ja/DZ/SRJTC17m2gV3ayYPnZeqSuvryhQ/S 2sRvubTAMNrjh3ZgJILjCoOLOqA+rKZBlTRHLgIC6g2K709p1H6ALBz59o2g65CwN4d6a1Z/ yYx9YxvbW6p5iOwQQ8sONSIgdGCxbQhLS5Ibv4eSa4oeNl2VTZ7XjJn2s/CeV5VkmtlokhjP Unr3mM8KSLqr7ztUBz9DUyquT7ccii6oYeG5z/YTBaHSLzFpP2IRZcuzPLFG4jzwX/Jd5+Yt 0kO4p5/NYUIf+kHlC7hipfFn498PIdzMarw9esnm/8iIYwQYEQoAIxYhBLWmwiCCn65daeuc o3wCv4U/5j4ABQJZaPWNBQkeAM0jAAoJEHwCv4U/5j4Aya0AoJijb+Unark3DdnQ8tcU/DqL 7gPiAJ9pZ+l/o6351Qq8Xna8dWnGIUKVxw== Message-ID: Date: Mon, 25 Feb 2019 10:46:03 +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: <57F7B086-B935-4E12-8FEA-A2F232EEDB43@dana.is> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HL9PgUMw0VGTuGTYccm4Os1oXCaSNUhCO" --HL9PgUMw0VGTuGTYccm4Os1oXCaSNUhCO Content-Type: multipart/mixed; boundary="SVOJNipt5aV9RxNeShbLsYOp78yjIIDuj"; protected-headers="v1" From: Daniel Hahler To: dana Cc: zsh-workers@zsh.org 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: <57F7B086-B935-4E12-8FEA-A2F232EEDB43@dana.is> --SVOJNipt5aV9RxNeShbLsYOp78yjIIDuj Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 24.02.19 20:46, dana wrote: >> This patch changes some of the "*::" to "*:", but is not really tested= >> in detail. Mostly based on trying if "--help" worked after any arg. >=20 > Some of these do look like they were just erroneously copied and pasted= , but > in other cases it's actually necessary, at least with the way it's writ= ten > now. For example, the commit-range-or-file state checks to see if $CURR= ENT is > 1, which can only ever be true if the *:: syntax (or equivalent) is use= d. I see, thanks for looking into it! Unfortunately this also affects / is true for state branch-or-tree-ish-or-file with _git-checkout already, which I've wanted to fix in the first place. Can this be fixed in a different way then? Currently it just returns: case $state in (branch-or-tree-ish-or-file) # TODO: Something about *:: brings us here when we complete at "-".= I # guess that this makes sense in a way, as we might want to treat i= t as # an argument, but I can't find anything in the documentation about= this # behavior. [[ $line[CURRENT] =3D -* ]] && return What about something like this (against master)? diff --git i/Completion/Unix/Command/_git w/Completion/Unix/Command/_git index b3e54f7f9..c134f13b8 100644 --- i/Completion/Unix/Command/_git +++ w/Completion/Unix/Command/_git @@ -449,7 +449,8 @@ _git-checkout () { local curcontext=3D$curcontext state line ret=3D1 declare -A opt_args - _arguments -C -s \ + local -a options + options=3D( '(-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,6 +470,9 @@ _git-checkout () { '--recurse-submodules=3D-[control recursive updating of submodules]:= :checkout:__git_commits' \ '(-q --quiet)--progress[force progress reporting]' \ '(-)--[start file arguments]' \ + ) + + _arguments -C -s $options \ '*:: :->branch-or-tree-ish-or-file' && ret=3D0 case $state in @@ -477,7 +481,7 @@ _git-checkout () { # 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 + _arguments -C -s $options && ret=3D0 && return if (( CURRENT =3D=3D 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B local \ > I didn't look at it much harder than that, but, in general, anywhere yo= u're > thinking about removing *:: or *:::, you need to check the correspondin= g state > code to see if it does anything with $words or $CURRENT, or calls anoth= er > function that does. >=20 > dana >=20 --SVOJNipt5aV9RxNeShbLsYOp78yjIIDuj-- --HL9PgUMw0VGTuGTYccm4Os1oXCaSNUhCO 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+AAUCXHO5WwAKCRB8Ar+FP+Y+ AOnWAJ9yTkcf/NNYUpEhrqSMRqQxl8gWlwCgrwHHxzGsEcJFD81YJIuF2HAY7E8= =S6np -----END PGP SIGNATURE----- --HL9PgUMw0VGTuGTYccm4Os1oXCaSNUhCO--