From: "Øystein Walle" <oystwa@gmail•com>
To: git@vger•kernel.org
Subject: Re: [PATCH v4] completion: ignore chpwd_functions when cding on zsh
Date: Thu, 9 Oct 2014 19:47:08 +0000 (UTC) [thread overview]
Message-ID: <loom.20141009T214418-680@post.gmane.org> (raw)
In-Reply-To: 1412881298-64117-1-git-send-email-bt@brandonturner.net
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
next prev parent reply other threads:[~2014-10-09 19:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 3:53 [PATCH] completion: ignore chpwd_functions when cding Brandon Turner
2014-10-08 18:12 ` Junio C Hamano
2014-10-08 21:49 ` [PATCH v2] " Brandon Turner
2014-10-08 21:49 ` [PATCH v3] completion: ignore chpwd_functions when cding on zsh Brandon Turner
2014-10-09 7:34 ` Øystein Walle
2014-10-09 18:10 ` Junio C Hamano
2014-10-09 19:01 ` [PATCH v4] " Brandon Turner
2014-10-09 19:47 ` Øystein Walle [this message]
2014-10-09 20:01 ` Junio C Hamano
2014-10-09 20:45 ` Junio C Hamano
2014-10-09 22:04 ` Brandon Turner
2014-10-09 22:11 ` Junio C Hamano
2014-10-09 22:30 ` Brandon Turner
2014-10-16 18:10 ` Øystein Walle
2014-10-09 19:21 ` [PATCH v3] " Øystein Walle
2014-10-08 21:50 ` [PATCH] completion: ignore chpwd_functions when cding Brandon Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20141009T214418-680@post.gmane.org \
--to=oystwa@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox