Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Improved completion for git commit objects (__git_commit_objects)
- X-seq: zsh-workers 34678
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: Improved completion for git commit objects (__git_commit_objects)
- Date: Sat, 7 Mar 2015 13:59:39 +0100
- Cc: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>, zsh workers <zsh-workers@xxxxxxx>
- 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==
- In-reply-to: <20150307040139.GC2206@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <54F647E2.5020400@thequod.de> <20150307040139.GC2206@tarsus.local2>
On Sat, Mar 7, 2015 at 5:01 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> [ 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 fallback.
>
> 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 <TAB> 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 — 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=4<TAB>
>> 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?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author