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

[PATCH v3] completion: ignore chpwd_functions when cding on zsh

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

Possibly related (same subject, not in this thread)

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

As I've only seen this so far on ZSH, I'm applying this change only to
the git-completion.zsh overrides.

Signed-off-by: Brandon Turner <redacted>
---
This applies the patch to zsh only using git-completion.zsh.

For more details on the RVM bug, see:
https://github.com/wayneeseguin/rvm/issues/3076
 contrib/completion/git-completion.zsh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 9f6f0fa..12ac984 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -93,6 +93,21 @@ __gitcomp_file ()
 	compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
 }
 
+__git_ls_files_helper ()
+{
+	(
+		test -n "${CDPATH+set}" && unset CDPATH
+		(( ${#chpwd_functions} )) && chpwd_functions=()
+		builtin cd "$1"
+		if [ "$2" == "--committable" ]; then
+			git diff-index --name-only --relative HEAD
+		else
+			# NOTE: $2 is not quoted in order to support multiple options
+			git ls-files --exclude-standard $2
+		fi
+	) 2>/dev/null
+}
+
 __git_zsh_bash_func ()
 {
 	emulate -L ksh
-- 
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