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

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

From: Øystein Walle <hidden>
Date: 2016-06-15 23:02:41

Possibly related (same subject, not in this thread)

Brandon Turner <bt <at> brandonturner.net> writes:
+__git_ls_files_helper ()
+{
+	(
+		test -n "${CDPATH+set}" && unset CDPATH
+		cd -q "$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
+}
+
(Sorry about this; I should've caught it the first time around). Zsh
does not split string expansions into several words by default. For
example:

    $ str1='hello world'
    $ str2='goodbye moon'
    $ printf '%s\n' $str1 $str2
    hello world
    goodbye moon

This can be enabled on a "per-expansion basis" by using = while
expanding: 

    $ str1='hello world'
    $ str2='goodbye moon'
    $ printf '%s\n' $=str1 $str2
    hello
    world
    goodbye moon

So the $2 in your patch should be $=2.

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.

Øsse
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help