Re: [PATCH v4] completion: ignore chpwd_functions when cding on zsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Øystein Walle <oystwa@xxxxxxxxx> writes:

> BUT: Over a year ago Git learned the -C argument. Couldn't we use that
> here? That way we would not have to unset CDPATH and can get rid of the
> subshell and cd -q. If we allow the other functions to use several
> arguments to pass options with we can get rid of the whole seperation
> between bash and zsh altogether.

Wow, that is an excellent suggestion.  It would look like the
attached, right?

By stepping away further and further from the originally proposed
solution and trying to identify the real problem that needs to be
solved, you reached a better solution ;-).

 contrib/completion/git-completion.bash | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5ea5b82..f22de9d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -281,16 +281,12 @@ __gitcomp_file ()
 # argument, and using the options specified in the second argument.
 __git_ls_files_helper ()
 {
-	(
-		test -n "${CDPATH+set}" && unset CDPATH
-		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
+	if [ "$2" == "--committable" ]; then
+		git -C "$1" diff-index --name-only --relative HEAD
+	else
+		# NOTE: $2 is not quoted in order to support multiple options
+		git -C "$1" ls-files --exclude-standard $2
+	fi 2>/dev/null
 }
 
 
--
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]