From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23827 invoked by alias); 26 Apr 2011 22:04:56 -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: 29069 Received: (qmail 29877 invoked from network); 26 Apr 2011 22:04:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=UEej1BQpR9TWpt1thjQLRdVlp7DAWK+95fLr8PS0W1o=; b=QD0Du6EkH6CNoBS7XBTXtG8HXOdahD/RD267ZWw6TQNPJoGSJErC5q39VY2+wFG/8K zffgWcJpyvzhNHnzx+GDw36kw9gec8VOz3+ZUsQKVS1ZXrIe8N0JI9V4dinKE5lnMOrG 52hIEoyJ7Gsco7c5ZpbWFLxVXazxKfj+7cqsE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jCp4+uimGp9RnX1AgLJLijGyCdRjgKSyxLP6EBlP1KSLU3akb9SnaYaEHV88QishSL fnTQMG760Kg+vgnbQjjkOQUeE8vbfTH8cwvmBE2RTbtcU8GloaUfykXE0pycHIcru9UP U6SGNF8gl72/w0gbLGJauM8QJqW64mZCu8KmA= MIME-Version: 1.0 In-Reply-To: References: <87liyw7t0o.fsf@ft.bewatermyfriend.org> Date: Wed, 27 Apr 2011 01:04:47 +0300 Message-ID: Subject: Re: Slowness issue with git completion From: Felipe Contreras To: "Benjamin R. Haskell" Cc: Mikael Magnusson , Frank Terbeck , zsh-workers@zsh.org, Nikolai Weibull Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Apr 27, 2011 at 12:52 AM, Benjamin R. Haskell wrot= e: > On Tue, 26 Apr 2011, Felipe Contreras wrote: > >> On Tue, Apr 26, 2011 at 11:34 PM, Mikael Magnusson wrote: >>> >>> On 26 April 2011 22:23, Felipe Contreras wrote: >>>> >>>> On Tue, Apr 26, 2011 at 9:43 PM, Frank Terbeck wrote: >>>>> >>>>> Felipe Contreras wrote: >>>>>> >>>>>> It's very easy to reproduce: >>>>>> % git clone >>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git >>>>>> linux >>>>>> % cd linux >>>>>> % git log v >>>>>> >>>>>> It will take a looong time to figure out anything, specially if not >>>>>> cached. I think I recall investigating the issue and finding that it= 's >>>>>> looking for *all* the files in the git repo. >>>>> >>>>> Well yes. This is a known issue. >>>>> >>>>> I'm fairly sure that this is due to _multi_parts, which probably >>>>> doesn't scale for jobs like that. =C2=A0I once gave rewriting all tha= t a shot and >>>>> ended up with a number of helpers for each "type" of file etc. (like >>>>> modified or ignored files). =C2=A0While they were significantly quick= er than the >>>>> current code, they were probably still full of bugs and shortcomings.= Also, >>>>> I would have had to rewrite *large* parts of the rest of the completi= on, >>>>> which would have been a *major* undertaking. >>>>> >>>>> In short: It's a known issue and it's very hard to fix (if only becau= se >>>>> it is a *lot* of work). >>>> >>>> Here's a quick solution: don't try to list files. If I want to list >>>> files, I would use '-- '. And in fact, that's exactly what the bash >>>> completion does. >>> >>> git accepts files with or without a -- >> >> So? > > So if git accepts filenames with or without the '--', Zsh's completion > should list filenames with or without the '--'. I already explained, you still can auto-complete; first you try the refs, if there's no ref, then you try the files. Why should I wait 10 seconds for the files to be ready if I'm trying to complete a ref? >>>> Moreover, why do you want to be smarter than git? There are ways to as= k >>>> git precisely what we want: list the contents of certain tree-ish on-d= emand. >>>> And in fact, that's exactly what the bash completion does: >>>> >>>> time git ls-tree HEAD -- (0m0.005s) >>>> time git ls-tree HEAD -- drivers/ (0m0.007s) >>> >>> git ls-tree doesn't allow you to filter the output files by 'changed', >>> 'new', 'unknown' etc etc. >> >> So? > > So 'ls-tree' doesn't list context-appropriate completions, which is what = Zsh > is providing. =C2=A0So, 'ls-tree' can't provide the list of files Zsh nee= ds. You don't need any "context-appropriate" completions for 'git log', 'git show' or anything similar to rev-list. All you need is the tree-ish information that ls-tree provides. For 'git add', zsh doesn't *need* that "context". It's just the way it was implemented in zsh, it's just status quo. It can easily be changed and nobody would notice. > The point is that the way bash does it ignores the context cues that Zsh > (very-)inefficiently exploits. > > If you don't care about the correctness, just modify __git_files to only > complete anything if it's already seen '--'. Nah. > It's a workaround. =C2=A0At some point, someone (probably someone partici= pating > in this thread) will figure out a proper solution. =C2=A0But until that h= appens > the workaround is better than breaking the context sensitivity of git > completion just to make it as fast as bash. I disagree. The "context sensitivity" doesn't work. The current behavior is broken. I say it should be the other way around, that "context sensitivity" which is only used for 'git add' should not make the rest of the commands dead slow, it should be disabled until it's working properly (fast). --=20 Felipe Contreras