Skip to content

Commit 1ca6d4b

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 240ae2b commit 1ca6d4b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contrib/completion/git-completion.zsh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ __gitcomp_file ()
7272
_git ()
7373
{
7474
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+
8383
let _ret && _default -S '' && _ret=0
8484
return _ret
8585
}

0 commit comments

Comments
 (0)