From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19278 invoked from network); 19 Aug 2008 01:09:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,WEIRD_PORT autolearn=no version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Aug 2008 01:09:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 97925 invoked from network); 19 Aug 2008 01:08:56 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Aug 2008 01:08:56 -0000 Received: (qmail 6550 invoked by alias); 19 Aug 2008 01:08:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25487 Received: (qmail 6525 invoked from network); 19 Aug 2008 01:08:37 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Aug 2008 01:08:37 -0000 Received: from cork.scru.org (cork.scru.org [209.20.67.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id CCD568058F37 for ; Tue, 19 Aug 2008 03:08:32 +0200 (CEST) Received: by cork.scru.org (Postfix, from userid 1000) id 309FC10408A; Tue, 19 Aug 2008 01:08:31 +0000 (UTC) Date: Tue, 19 Aug 2008 01:08:31 +0000 From: Clint Adams To: zsh-workers Subject: Re: Fix a typo in _git. Message-ID: <20080819010831.GC13979@scru.org> Mail-Followup-To: zsh-workers References: <237967ef0808151656j7787f169g4b3456910e05bfc2@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <237967ef0808151656j7787f169g4b3456910e05bfc2@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.92.1/8056/Mon Aug 18 16:33:41 2008 on bifrost X-Virus-Status: Clean On Sat, Aug 16, 2008 at 01:56:36AM +0200, Mikael Magnusson wrote: > http://git.mika.l3ib.org/?p=zsh-cvs.git;a=history;f=Completion/Unix/Command/_git;h=mika whitespace From: Mikael Magnusson Date: Sun, 17 Aug 2008 23:23:53 +0000 (+0200) Subject: _git: Most confusing indentation in the history of mankind. X-Git-Url: http://git.mika.l3ib.org:1234/?p=zsh-cvs.git;a=commitdiff_plain;h=b1b10fcea1f6b4fc9da7386bf38320d10bdd199b _git: Most confusing indentation in the history of mankind. --- diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 03ebe31..be32c96 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4261,54 +4261,54 @@ __git_is_indexed () { [[ -n $(git ls-files $REPLY) ]] } - local curcontext=$curcontext ret=1 - - # fun with $words[] and $CURRENT to enable completion for args - # to git aliases (eg. git co ) - local -A git_aliases - # TODO: filling git_aliases like this is ugly. I didn't get it working elegantly. - local oifs=$IFS - IFS=$'\0' - git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}}) - IFS=$oifs ; unset oifs - - if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then - local -a tmpwords - tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]}) - if [[ -z "${words[3,-1]}" ]] ; then - tmpwords[$(( ${#tmpwords} + 1 ))]="" - else - tmpwords+=("${words[3,-1]}") - fi - words=("${tmpwords[@]}") - (( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 )) - unset tmpwords - fi - - if [[ $service == git ]]; then - local state line - declare -A opt_args - _arguments -C \ - '(- :)--version[display version information]' \ - '(- :)--help[display help message]' \ - '--exec-path=-[path containing core git-programs]::directory:_directories' \ - '(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \ - '--git-dir=-[path to repository]:directory:_directories' \ - '--bare[use $PWD as repository]' \ - ':command:->command' \ - '*::options:->options' && ret=0 - case $state in - (command) - __git_aliases_and_commands - ;; - (options) - curcontext="${curcontext%:*:*}:git-$words[1]:" - _call_function ret _git-$words[1] - ;; - esac +local curcontext=$curcontext ret=1 + +# fun with $words[] and $CURRENT to enable completion for args +# to git aliases (eg. git co ) +local -A git_aliases +# TODO: filling git_aliases like this is ugly. I didn't get it working elegantly. +local oifs=$IFS +IFS=$'\0' +git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}}) +IFS=$oifs ; unset oifs + +if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then + local -a tmpwords + tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]}) + if [[ -z "${words[3,-1]}" ]] ; then + tmpwords[$(( ${#tmpwords} + 1 ))]="" else - _call_function ret _$service + tmpwords+=("${words[3,-1]}") fi + words=("${tmpwords[@]}") + (( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 )) + unset tmpwords +fi + +if [[ $service == git ]]; then + local state line + declare -A opt_args + _arguments -C \ + '(- :)--version[display version information]' \ + '(- :)--help[display help message]' \ + '--exec-path=-[path containing core git-programs]::directory:_directories' \ + '(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \ + '--git-dir=-[path to repository]:directory:_directories' \ + '--bare[use $PWD as repository]' \ + ':command:->command' \ + '*::options:->options' && ret=0 + case $state in + (command) + __git_aliases_and_commands + ;; + (options) + curcontext="${curcontext%:*:*}:git-$words[1]:" + _call_function ret _git-$words[1] + ;; + esac +else + _call_function ret _$service +fi } _git