On Fri, Nov 16, 2012 at 4:56 PM, Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote: > On Fri, Nov 16, 2012 at 10:20 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > >> The point is not about the quality of zsh's emulation >> of (k)sh when it is run under that mode, but is about not having to >> have that logic in bash-only part in the first place. > > As I said, that logic can be moved away _if_ my wrapper is merged. But > then again, that would cause regressions to existing users. Please forgive me as I don't know the background of the efforts for zsh git-completion or the syntax for zsh completion, but I thought I'd mention another approach I tried for tcsh which may work for zsh. I gather that using a wrapper for zsh causes concerns about backwards-compatibility. So, what could be done is have the bash script do both jobs: setup the zsh completion commands, and output the git completion using bash itself. At the top of git-completion.bash (or it could be even pushed at the bottom using if/else) we could use: if [[ -n ${ZSH_VERSION-} ]]; then # replace below by zsh completion commands calling `bash ${HOME}/.git-completion.bash` complete git 'p/*/`bash ${HOME}/.git-completion.bash ${COMMAND_LINE}`/' complete gitk 'p/*/`bash ${HOME}/.git-completion.bash ${COMMAND_LINE}`/' exit fi That way the zsh user would still simply do 'source ~/.git-completion.bash' which would only execute the two zsh completion setup commands. Then, when completion is triggered, it calls `bash ${HOME}/.git-completion.bash ${COMMAND_LINE}` and processes the output like tcsh does. This limits the zsh-specific code to 2 lines for the entire script. I got this to work for tcsh (solution (B)) adding the following a the top of git-completion.bash: test "$tcsh" != "" && \ complete git 'p,*,`${HOME}/.git-completion.sh "${COMMAND_LINE}"|\sort|\uniq`,' && \ complete gitk 'p,*,`${HOME}/.git-completion.sh "${COMMAND_LINE}"|\sort|\uniq`,' && \ exit but I didn't think people would go for that since those lines have to work in both bash and tcsh syntax. I thought this made the script a bit brittle. Just a thought. Marc -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html