Re: [PATCH] completion: ignore chpwd_functions when cding
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 8, 2014, 18:12 UTC
- Message-ID
- <xmqqh9zebfc6.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1412740394-34061-1-git-send-email-bt@brandonturner.net>
Brandon Turner <bt@brandonturner.net> writes:
Show 6 quoted lines
> Software, such as RVM (ruby version manager), may set chpwd functions > that result in an endless loop when cding. chpwd functions should be > ignored. > > Signed-off-by: Brandon Turner <bt@brandonturner.net> > ---
Can you mention that this is abomination limited only to zsh somewhere in the log message? Or does bash share the same glitch?
If this is limited to zsh, I wonder if we can take advantage of the fact that we have git-completion.bash and git-completion.zsh to avoid contaminating shared part of the code.
Thanks.
Show 20 quoted lines
> For an example of this bug, see:
> https://github.com/wayneeseguin/rvm/issues/3076
>
> contrib/completion/git-completion.bash | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 06bf262..996de31 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -283,7 +283,8 @@ __git_ls_files_helper ()
> {
> (
> test -n "${CDPATH+set}" && unset CDPATH
> - cd "$1"
> + (( ${#chpwd_functions} )) && chpwd_functions=()
> + builtin cd "$1"
> if [ "$2" == "--committable" ]; then
> git diff-index --name-only --relative HEAD
> else