Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Git completion slowness
- X-seq: zsh-workers 28520
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Git completion slowness
- Date: Fri, 10 Dec 2010 13:48:08 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1291985289; bh=NAnOIcDAq0UAVVegMoeDeal5MDs/PJjRVCqlUR1R2CU=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=2JxHFUoJc/yjueunzQcJ+sLGQvIJHkmaQDpk83lHQk+DDZPLiq1y+VLarNm3oxYMLqr3Mj22WadyFSygRsdY5Ug5ZD4ND1x2bm2Gvp4qFMAeW8sC8w8KukRfLJSWg1pPf42y5q0hI3/ADzBhSPlUz5sIZdwwQ5mju91PAhObQoM=
- In-reply-to: <alpine.LNX.2.01.1012091710280.2792@hp>
- 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: <AANLkTi=4OkTExqGZOCY8B64HGatuKh9S=8hkfKkMrF3K@xxxxxxxxxxxxxx> <alpine.LNX.2.01.1012091710280.2792@hp>
"Benjamin R. Haskell" wrote:
> That prevents all git file completion, which is the cause of the
> slowness (specifically, _multi_parts completion for filenames). Recall
It's never a great idea when some function tries to do it's own filename
completion. While perhaps not blazingly fast, I very much think that the
approach I took in _subversion is the best. That approach is to use
_files for the actual completion and use the e glob qualifier to filter
the files. That way, the many configuration styles and everything for
filename completion works as normal. I notice that _git is completing
dot files for me without an initial dot for instance.
So for _git-add, we'd need something like:
__git_filestatus() {
[[ $(git status --porcelain $REPLY) = ?M* ]]
}
__git_modified_files () {
_files -g "*(.e:__git_filestatus:)"
}
That may need to run git status for every file but that's way better
than recursing through every subdirectory. Note that it is possible to
add non-existant files - look at _subversion for an example.
This also loses you the division of files into ignored-modified-files,
ignored-other-files etc but you can actually put that back in with a
suitable file-patterns style provided __git_filestatus doesn't hard code
the regex/pattern (and options needed for e.g. ignored files).
I would work on this but if Nikolai has a rewritten _git, I'll hold off.
By the way, what's with all the double underscores in _git. Is there
some meaning to those or has someone just been doing too much Python.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author