From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12312 invoked from network); 1 Oct 2007 13:57:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Oct 2007 13:57:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 77422 invoked from network); 1 Oct 2007 13:57:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Oct 2007 13:57:07 -0000 Received: (qmail 9854 invoked by alias); 1 Oct 2007 13:57:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23888 Received: (qmail 9834 invoked from network); 1 Oct 2007 13:57:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Oct 2007 13:57:04 -0000 Received: (qmail 76959 invoked from network); 1 Oct 2007 13:57:04 -0000 Received: from wr-out-0506.google.com (64.233.184.229) by a.mx.sunsite.dk with SMTP; 1 Oct 2007 13:56:58 -0000 Received: by wr-out-0506.google.com with SMTP id c48so1847015wra for ; Mon, 01 Oct 2007 06:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=r+KnqiKCm0FPIJHks2N7TvaWdOQqN2ye+SUQBpuaAkM=; b=jvhlsRIaayWh+uhtSBEVgqTBZRDtkWXGONbFRWr7K+P6jMAqrn3z6FxaGVgjXK4TJK78x1lhA+tY79Hnaup08+0K2OLt3r1/WQ6nsLB9nNmdSh7N9RGlZBgXrJHCpKhEbKTNUVKr/TAQ6MxrXYm3t2LUtHOLH1jX7svi8jq9TyU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Mt/oTAxHoVI1hsN74WP3tPqgUSO3BreCpf2PcS9ROIUWYqW3L9oSKZnIRKKi9KPOT/YZcVSfDlVw+2oFjLUP9AEbVA5JLBiDfHE++NfK4utteebPuH9MPkynsMzJgVGDlQUxjxKhjjJCDG9FVEpSEeXWa1Hsndl11ZG2VUMr79Y= Received: by 10.90.49.1 with SMTP id w1mr4592529agw.1191247003815; Mon, 01 Oct 2007 06:56:43 -0700 (PDT) Received: by 10.90.93.19 with HTTP; Mon, 1 Oct 2007 06:56:43 -0700 (PDT) Message-ID: Date: Mon, 1 Oct 2007 15:56:43 +0200 From: "Nikolai Weibull" Sender: nikolai.weibull@gmail.com To: zsh-workers@sunsite.dk Subject: Re: PATCH: _git log arguments In-Reply-To: <20071001133635.GA10543@scowler.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070930194014.GA18558@scowler.net> <20071001133635.GA10543@scowler.net> X-Google-Sender-Auth: cba44c89d0f2e88a On 10/1/07, Clint Adams wrote: > On Mon, Oct 01, 2007 at 09:16:54AM +0200, Nikolai Weibull wrote: > > Why use "$revision_arguments[@]"? $revision_arguments works just as > > good and you don't need all the quoting and expansion fluff. I see > > this style has been used for $merge_args as well, even though most of > > the file doesn't. > > I seem to recall it being necessary for $merge_args, though I don't > recall the specifics. > > > > + '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0 > > > > I don't like this at all. Why not simply use __git_cached_files? And > > if we really need __git_committishs, let's at least use a separate > > function for that with proper descriptions and tags. > > Your patch reworked against HEAD is below. Now how do we accommodate > the people that want to have a branch name completed after git log? This should really be context sensitive, that is, what to complete here is dependent on what arguments we've seen already. Here's a patch that will suffice for the time being: Index: Completion/Unix/Command/_git =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v retrieving revision 1.37 diff -u -r1.37 _git --- Completion/Unix/Command/_git 1 Oct 2007 13:37:31 -0000 1.37 +++ Completion/Unix/Command/_git 1 Oct 2007 13:55:53 -0000 @@ -1702,11 +1702,22 @@ (( $+functions[_git-log] )) || _git-log () { + local curcontext=$curcontext state line + declare -A opt_args + __git_setup_revision_arguments _arguments -S \ $revision_arguments \ - '*:file:__git_cached_files' && ret=0 + '*:file-or-branch:->files' && ret=0 + + case $state in + (files) + _alternative \ + 'files:index file:__git_cached_files' \ + 'branches:branch:__git_branch_names' && ret=0 + ;; + esac } # TODO: repository needs fixing nikolai