From: Clint Adams <clint@zsh.org>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: Fix a typo in _git.
Date: Tue, 19 Aug 2008 01:08:31 +0000 [thread overview]
Message-ID: <20080819010831.GC13979@scru.org> (raw)
In-Reply-To: <237967ef0808151656j7787f169g4b3456910e05bfc2@mail.gmail.com>
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 <mikachu@gmail.com>
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 <TAB>)
- 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 <TAB>)
+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
next prev parent reply other threads:[~2008-08-19 1:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-15 23:56 Mikael Magnusson
2008-08-16 0:45 ` Clint Adams
2008-08-16 12:56 ` Clint Adams
2008-08-16 13:25 ` Clint Adams
2008-08-16 13:55 ` Clint Adams
2008-08-16 16:15 ` Clint Adams
2008-08-16 17:59 ` Clint Adams
2008-08-16 18:29 ` Clint Adams
2008-08-17 14:03 ` Clint Adams
2008-08-17 17:13 ` Clint Adams
2008-08-17 17:27 ` Mikael Magnusson
2008-08-18 1:46 ` Clint Adams
2008-08-18 9:47 ` Mikael Magnusson
2008-08-18 20:10 ` Mikael Magnusson
2008-08-18 22:45 ` Clint Adams
2008-08-19 0:09 ` Mikael Magnusson
2008-08-19 0:25 ` Clint Adams
2008-08-19 0:37 ` Mikael Magnusson
2008-08-19 0:39 ` Mikael Magnusson
2008-08-19 0:58 ` Clint Adams
2008-08-19 1:05 ` Clint Adams
2008-08-17 23:23 ` Mikael Magnusson
2008-08-17 23:30 ` Mikael Magnusson
2008-08-18 0:08 ` Phil Pennock
2008-08-19 1:08 ` Clint Adams [this message]
2008-08-19 1:41 ` Clint Adams
-- strict thread matches above, loose matches on Subject: below --
2007-10-18 21:23 Mikael Magnusson
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=20080819010831.GC13979@scru.org \
--to=clint@zsh.org \
--cc=zsh-workers@sunsite.dk \
/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).