From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11177 invoked by alias); 7 Mar 2015 12:59:47 -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: 34678 Received: (qmail 11926 invoked from network); 7 Mar 2015 12:59:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=bkqcrl6ozE4Al7mCbiLoH4mL1Qfo8f0TjAOMM4rHoaI=; b=wtUDICsRcq5EPxNIBdtaPlZK5MdpGBF0MEZg7bLr1NX1y8FwBC8wP0Bcj+A64l3aih k98tzdWwPLPjOV8lqdi44jDNA8mIoh0lt3R/nnGDy9wg30woJHMzIUMxF9XqrJhqhI3+ 8jy8BW0W4bYFthtVfWlQ0ioLmgFqHE7nxC/sBiAH7CSCZCvJTHdFEnp13G3N33erBvLq Nls3hB2cOvlUxvUW601OG6RhtttShlSCBq131UNUh7lmZwScjC2P8+ifwat3qJhNxTWw jSo/oeZbS6CWaROJgckLH2g+zun0Lpq3omG3gRkxvDVtCF2kIuurVllxQdqwNPdN3xAy x2cg== MIME-Version: 1.0 X-Received: by 10.107.153.193 with SMTP id b184mr35096252ioe.85.1425733179630; Sat, 07 Mar 2015 04:59:39 -0800 (PST) In-Reply-To: <20150307040139.GC2206@tarsus.local2> References: <54F647E2.5020400@thequod.de> <20150307040139.GC2206@tarsus.local2> Date: Sat, 7 Mar 2015 13:59:39 +0100 Message-ID: Subject: Re: Improved completion for git commit objects (__git_commit_objects) From: Mikael Magnusson To: Daniel Shahaf Cc: Daniel Hahler , zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Mar 7, 2015 at 5:01 AM, Daniel Shahaf wrot= e: > [ tl;dr: applied patch, attaching further patches for _git and _describe = ] > > Daniel Hahler wrote on Wed, Mar 04, 2015 at 00:46:42 +0100: >> Hi, >> >> I am trying to improve completion for Git commit objects. >> >> __git_commit_objects is defined as follows (in Completion/Unix/Command/_= git): >> >> __git_commit_objects () { >> _guard '[[:xdigit:]](#c,40)' 'commit object name' >> } >> >> I think it would be great if it actually (optionally?) could provide >> completion for commit objects, maybe only on second invocation / as fall= back. > > Good morning Daniel, > > Hope you don't mind, but I went ahead and tweaked your function a bit: > > 1. I removed the _guard call which generated a spurious message and > prevented from inserting a unique completion to the command line > in my configuration. > > 2. I used _describe instead of 'compadd -k'. > > I've committed the patch with these changes. Thanks for the patch! > > I also made two follow-ups. The first completes only tags/branches that > refer to one of the most recent N commits, rather than all tags and > branches =E2=80=94 see attached. WDYT? > > The second follow-up sorts the hashes offered (as completions) > chronologically, rather than alphabetically, by extending _describe. > I'd appreciate some review of this one, to make sure I didn't miss > anything. > > With all these patches applied, I get (in the zsh repo): > > % git ci --fixup=3D4 >> commit object name > 4bc554b -- 34636: replace broken isprint() on Mac OS X > 42e5f59 -- 34640: clarify documentation for _guard function > 4edcacb -- users/19934: document %D{...} for WATCHFMT > 49776e8 -- 34588: Complete 'usermod -a' When I tried adding sha1 completion a few years ago, the big showstopper was that any completion of a commit-ish or any -ish for that matter, would take several minutes in the linux kernel, since it has millions of blobs. Is this faster? --=20 Mikael Magnusson