zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Git completion slowness
Date: Fri, 10 Dec 2010 13:48:08 +0100	[thread overview]
Message-ID: <631.1291985288@thecus> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2010-12-10 12:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 22:06 Brett Simmers
2010-12-09 22:18 ` Benjamin R. Haskell
2010-12-10  0:10   ` Brett Simmers
     [not found]   ` <87k4jhsx78.fsf@ft.bewatermyfriend.org>
2010-12-10 11:37     ` Nikolai Weibull
2010-12-10 11:49       ` Frank Terbeck
2010-12-10 12:09         ` Nikolai Weibull
2010-12-10 11:54       ` Thomas Gstädtner
2010-12-10 12:11         ` Nikolai Weibull
2010-12-10 12:48   ` Oliver Kiddle [this message]
2010-12-10 14:00     ` Nikolai Weibull
2010-12-10 11:29 ` Nikolai Weibull

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=631.1291985288@thecus \
    --to=okiddle@yahoo.co.uk \
    --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).