From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10133 invoked by alias); 16 Aug 2017 09:45: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: X-Seq: 41552 Received: (qmail 20945 invoked by uid 1010); 16 Aug 2017 09:45:04 -0000 X-Qmail-Scanner-Diagnostics: from nm38-vm6.bullet.mail.ir2.yahoo.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(212.82.97.156):SA:0(-4.7/5.0):. Processed in 5.092553 secs); 16 Aug 2017 09:45:04 -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=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1502876260; bh=BsFY0fLmRUzg+KoB0IfDzOfgpd85ta8d9bEbZxjkLb8=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=bwHI5DU4ynGzdPe588mZ2vztE4NRHgR+PapasKmDN13ILF2Mb0+ekods0+r0BMY9XgQYA1fpicz+/n0AXqeM18jcHOqSdWrq9wYxHd/XZsZLkb5ThtwF4rpAOHO4y2z3ZVVD5ATMSMNq0ei22eSAH9Z2uxLvdSQVfVMV9eiH/W1nnXwk1UcH/yeBgT35NAbtEBVGIeZrQjlXNmM5SpcF0trh83E3jiZ0TJg91jV0w71tBnlDiRYn0w4P52ybAKZs7O3gANorMBeM6F2dpZSlq6M7WABL+JWM5hgGrZQzt4AYXvz+AVwwNnPAQwBMxtmAWSOKbwtrz0YDzMrhPSciqw== X-Yahoo-Newman-Id: 346585.23018.bm@smtp105.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: WF0hW7EVM1mOOzB6lJhpt_hDDtlc0oFxFism8MKJ.Gp6HdQ cKTmoEeSudpBT_2fXdonbNoCnkbNHPvBB1NM7HR5HzhzL9y.BAnuljUbL1uP NqiV9a_dbJwhmgyBBqfJ5MFSxcLq2.TwwYugRIBHsLinjvfj8DIbpOzgNTNC bTS3O0K1dVVEEeiuBkYBpBxloV0R2O1wjAotqSmjKFllnOeMm.6jB1XTxqpg b5gBP_kueyTIuoISuhQcsqSKzAbO5Q6IqPXpt2ubzrhN1Vyymrh4GvPMMj2j bqj0faLm6Ch8EWzeurCre5ZTbuG.eh3u3M8n3d7o7i.XJpr4knAFJSK7gDA7 XOMY1S0axrWTiVfFk3f1tvrVSEVPESq2h.njPq4GJ4kDwSbQCjKze0axkbEN 2YGCR8x0NEORcRAHv7EqTOCITR1J_JyN.IjDZvByDituZOjH42Xb4uKlaicJ SNZi3mWmTqXokCZZtwqtWu9bn6fUhembI4rCd0MFEpuD5.Q-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <20170816042617.lud425bn2ycahy5d@tarpaulin.shahaf.local2> From: Oliver Kiddle References: <20170809193113.3gjq3ezigb6yvdu4@tarpaulin.shahaf.local2> <15766.1502711853@thecus.kiddle.eu> <20170816042617.lud425bn2ycahy5d@tarpaulin.shahaf.local2> To: zsh-workers@zsh.org Subject: Re: git worktree add /foo MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21781.1502876249.1@thecus.kiddle.eu> Date: Wed, 16 Aug 2017 11:37:29 +0200 Message-ID: <21782.1502876249@thecus.kiddle.eu> Daniel Shahaf wrote: > > intention. Specifying --detach would be superfluous for anything but > > a branch because it is the default for any other committish so after > > --detach there is sense in only completing branches. > +1 > > I often apply logic such as this but it might not always be helpful, > > such as if --detach comes from an alias. > I don't understand. Firstly, both zsh aliases and git aliases are > 'seen through' in completion; secondly, the perfect shouldn't be the > enemy of the good. If --detach comes from an alias, the user didn't go to the effort of typing it. So there's a higher chance of the user wanting the pedantically correct (or perfect) behaviour of completing all commits rather than our too clever by half (or good) behaviour. However, I tend to find that cutting down the number of completion matches where possible is nearly always helpful. > > Otherwise, as you say, any committish is valid and our usual approach > > is to just complete them all and expect user's to set tag-order to give > > preference to the matches they find most useful. I suggested years back > > that we perhaps add a mechanism for giving a default tag-order and > > perhaps should consider it again. > > Let's collect a few such settings before we invent a mechanism; it's > easier to invent when there are concrete details to work with. Fair enough. I don't have any tag or group ordering styles for git myself though I may have been put off trying on a couple of occasions due to nested tag loops making it not entirely trivial. > So, yes, reversing the if and adding a tag-order/group-order style > should suffice. Ok, patch below reverses the if. > Additionally, it would be nice if the group description said > "(alternatively specify name of new branch)" like _mkdir does. Doesn't it need -b to create a new branch? In such cases, compadd -x should be used for explanations instead of -X. Oliver diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 518e6d198..26554de05 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2027,9 +2027,9 @@ _git-worktree() { case $line[1] in (add) if (( $words[(I)--detach] )); then - args=( ':commit:__git_commits' ) - else args=( ':branch:__git_branch_names' ) + else + args=( ':commit:__git_commits' ) fi _arguments \ '(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \