summaryrefslogtreecommitdiff
path: root/name-hash.c
diff options
context:
space:
mode:
authorLibravatar Mark Lodato <lodatom@gmail.com>2010-09-06 08:33:19 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-09-09 15:47:47 -0700
commit06f44c3cc5ca5eca638f300a518c65aa98d26d6d (patch)
treee19f0a3dac92e2782513a555d4d7b28e5c4dc22f /name-hash.c
parentMerge branch 'tf/cleanup-builtin-help-headers' (diff)
downloadtgif-06f44c3cc5ca5eca638f300a518c65aa98d26d6d.tar.xz
completion: make compatible with zsh
Modify git-completion.bash so that it also works with zsh when using bashcompinit. In particular: declare -F Zsh doesn't have the same 'declare -F' as bash, but 'declare -f' is the same, and it works just as well for our purposes. ${var:2} Zsh does not implement ${var:2} to skip the first 2 characters, but ${var#??} works in both shells to replace the first 2 characters with nothing. Thanks to Jonathan Nieder for the suggestion. for (( n=1; "$n" ... )) Zsh does not allow "$var" in arithmetic loops. Instead, pre-compute the endpoint and use the variables without $'s or quotes. shopt Zsh uses 'setopt', which has a different syntax than 'shopt'. Since 'shopt' is used infrequently in git-completion, we provide a bare-bones emulation. emulate -L bash KSH_TYPESET Zsh offers bash emulation, which turns on a set of features to closely resemble bash. In particular, this enables SH_WORDSPLIT, which splits scalar variables on word boundaries in 'for' loops. We also need to set KSH_TYPESET, to fix "local var=$(echo foo bar)" issues. The last set of options are turned on only in _git and _gitk. Some of the sub-functions may not work correctly if called directly. Signed-off-by: Mark Lodato <lodatom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
0 files changed, 0 insertions, 0 deletions