Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Fix a typo in _git.
- X-seq: zsh-workers 25487
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: Fix a typo in _git.
- Date: Tue, 19 Aug 2008 01:08:31 +0000
- In-reply-to: <237967ef0808151656j7787f169g4b3456910e05bfc2@xxxxxxxxxxxxxx>
- Mail-followup-to: zsh-workers <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <237967ef0808151656j7787f169g4b3456910e05bfc2@xxxxxxxxxxxxxx>
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@xxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author