Skip to content

Commit

Permalink
complete: zsh: trivial simplification
Browse files Browse the repository at this point in the history
There should be no functional changes.

The only reason I wrapped this code around a sub-function is because zsh
did the same in it's bashcompinit script in order to declare the special
variable 'words' as hidden, but only in this context.

There's no need for that any more since we access __git_main directly,
so 'words' is not modified, so there's no need for the sub-function.

In zsh mode the array indexes are different though.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Apr 29, 2013
1 parent 240ae2b commit 1ca6d4b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contrib/completion/git-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ __gitcomp_file ()
_git ()
{
local _ret=1
() {
emulate -L ksh
local cur cword prev
cur=${words[CURRENT-1]}
prev=${words[CURRENT-2]}
let cword=CURRENT-1
__${service}_main
}
local cur cword prev

cur=${words[CURRENT]}
prev=${words[CURRENT-1]}
let cword=CURRENT-1

emulate ksh -c __${service}_main

let _ret && _default -S '' && _ret=0
return _ret
}
Expand Down

0 comments on commit 1ca6d4b

Please sign in to comment.