From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Nikolai Weibull <now@bitwi.se>,
Mikael Magnusson <mikachu@gmail.com>,
Frank Terbeck <ft@bewatermyfriend.org>,
zsh-workers@zsh.org
Subject: Re: Slowness issue with git completion
Date: Wed, 27 Apr 2011 03:01:13 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.01.1104270232400.28316@hp> (raw)
In-Reply-To: <alpine.LNX.2.01.1104261840570.28316@hp>
On Tue, 26 Apr 2011, Benjamin R. Haskell wrote:
> On Wed, 27 Apr 2011, Felipe Contreras wrote:
>> Now, how about you make a compromise between "correctness" and
>> usability? [...] Are you interested in fixing this use-case even if
>> it means to make some compromises in correctness or not?
>
> I'll take a look at a better workaround tonight. [...]
Aside from the segfault that I just reported, the following seems to be
a far better out-of-tree workaround (i.e. in ~/.zshrc or thereabouts).
Completion returns in less than a second in the kernel repo, grabbing
correct-looking files and directories. But the segfault seems to occur
when successfully completing a file in any dir other than the root,
rendering this useless for the moment.
__git_files () {
# localize options as appropriate
local compadd_opts opts tag description
# ignore compadd-related options that __git_files passes along
zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F:
# ignore git ls-files options that __git_files uses
zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+:
# __git_files expects a tag and a description
tag=$1 description=$2 ; shift 2
# but we ignore those and call __git_tree_files against the HEAD revision
# with the current PREFIX
__git_tree_files ${PREFIX:-.} HEAD
}
If moved in-tree, this function could be renamed to __git_files_shortcircuit,
and the real __git_files could be modified to use this function except when
$curcontext =~ *:git-add: (perhaps conditioned on some zstyle).
I tend to favor "correctness" over shortcuts like this[1]. But, I'm also of
the opinion that "virtually-instantaneous, kindof-correct" is better than
"virtually-forever, absolutely-correct"[2].
Will take a look at the segfault again tomorrow if no one sees something
obvious.
--
Best,
Ben
[1] http://www.zsh.org/mla/workers/2010/msg00297.html
[2] http://lists.pioto.org/pipermail/paludis-user/2008-December/000726.html
next prev parent reply other threads:[~2011-04-27 7:01 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 18:26 Felipe Contreras
2011-04-26 18:43 ` Frank Terbeck
2011-04-26 19:06 ` Nikolai Weibull
2011-04-26 20:10 ` Frank Terbeck
2011-04-26 20:23 ` Felipe Contreras
2011-04-26 20:34 ` Mikael Magnusson
2011-04-26 20:57 ` Felipe Contreras
2011-04-26 20:59 ` Mikael Magnusson
2011-04-26 21:10 ` Felipe Contreras
2011-04-26 21:13 ` Mikael Magnusson
2011-04-26 21:35 ` Felipe Contreras
2011-04-26 22:03 ` Nikolai Weibull
2011-04-26 22:25 ` Felipe Contreras
2011-04-26 23:14 ` Benjamin R. Haskell
2011-04-27 7:01 ` Benjamin R. Haskell [this message]
2011-04-27 1:52 ` gi1242+zsh
2011-04-27 6:11 ` Nikolai Weibull
2011-04-27 8:30 ` Felipe Contreras
2011-04-27 8:47 ` Frank Terbeck
2011-04-27 9:06 ` Felipe Contreras
2011-04-27 10:15 ` Nikolai Weibull
2011-04-27 10:42 ` Felipe Contreras
2011-04-27 11:14 ` Nikolai Weibull
2011-04-27 4:19 ` Bart Schaefer
2011-04-27 6:13 ` Nikolai Weibull
2011-04-27 12:51 ` Nikolai Weibull
2011-04-27 14:55 ` Bart Schaefer
2011-04-27 18:36 ` Nikolai Weibull
2011-04-30 14:37 ` Simon Ruderich
2011-04-30 15:00 ` Simon Ruderich
2011-05-02 9:59 ` Nikolai Weibull
2011-05-03 13:59 ` Nikolai Weibull
2011-04-26 21:52 ` Benjamin R. Haskell
2011-04-26 22:04 ` Felipe Contreras
2011-04-26 22:35 ` Benjamin R. Haskell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.01.1104270232400.28316@hp \
--to=zsh@benizi.com \
--cc=felipe.contreras@gmail.com \
--cc=ft@bewatermyfriend.org \
--cc=mikachu@gmail.com \
--cc=now@bitwi.se \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).