complete: zsh: trivial simplification
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>
Felipe Contreras committed
Apr 27, 2013 at 15:34 UTC
1ca6d4bc426435ecb87c6eb7802e83ff0a2f1667
1 file changed
+8
-8
contrib/completion/git-completion.zsh
+8
-8
@@ -72,14 +72,14 @@ __gitcomp_file ()
72
_git ()
73
{
74
local _ret=1
75
- () {
76
- emulate -L ksh
77
- local cur cword prev
78
- cur=${words[CURRENT-1]}
79
- prev=${words[CURRENT-2]}
80
- let cword=CURRENT-1
81
- __${service}_main
82
- }
75
+ local cur cword prev
76
+
77
+ cur=${words[CURRENT]}
78
+ prev=${words[CURRENT-1]}
79
+ let cword=CURRENT-1
80
+
81
+ emulate ksh -c __${service}_main
82
+
83
let _ret && _default -S '' && _ret=0
84
return _ret
85
}