Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15
STALE3735d

[PATCH v2] completion: ignore chpwd_functions when cding

From: Brandon Turner <hidden>
Date: 2016-06-15 23:02:40
Subsystem: the rest · Maintainer: Linus Torvalds

Software, such as RVM (ruby version manager), may set chpwd functions
that result in an endless loop when cding.  chpwd functions should be
ignored.

I have only noticed the RVM bug on ZSH, bash seems unaffected.  However
this change seems safe to apply to both bash and zsh as we cannot
control what functions users add to chpwd_functions.

Signed-off-by: Brandon Turner <redacted>
---
This addresses Junio's request to update the log message.  The patch
still applies to bash and zsh.

For more information on the RVM 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
-- 
2.1.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help