git-commit-vandalism/contrib/completion
Matthieu Moy 35ba83ccf6 git-completion.bash: zsh does not implement function redirection correctly
A recent change added functions whose entire standard error stream
is redirected to /dev/null using a construct that is valid POSIX.1
but is not widely used:

	funcname () {
		cd "$1" && run some command "$2"
	} 2>/dev/null

Even though this file is "git-completion.bash", zsh completion
support dot-sources it (instead of asking bash to grok it like tcsh
completion does), and zsh does not implement this redirection
correctly.

With zsh, trying to complete an inexistant directory gave this:

  git add no-such-dir/__git_ls_files_helper💿2: no such file or directory: no-such-dir/

Also these functions use "cd" to first go somewhere else before
running a command, but the location the caller wants them to go that
is given as an argument to them should not be affected by CDPATH
variable the users may have set for their interactive session.

To fix both of these, wrap the body of the function in a subshell,
unset CDPATH at the beginning of the subshell, and redirect the
standard error stream of the subshell to /dev/null.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-11 10:22:56 -07:00
..
git-completion.bash git-completion.bash: zsh does not implement function redirection correctly 2013-03-11 10:22:56 -07:00
git-completion.tcsh Add file completion to tcsh git completion. 2012-12-11 21:49:25 -08:00
git-completion.zsh git-completion.zsh: define __gitcomp_file compatibility function 2013-03-05 08:54:03 -08:00
git-prompt.sh Merge branch 'so/prompt-command' 2012-12-12 11:08:13 -08:00