diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-08-08 12:08:17 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-08-08 14:36:33 -0700 |
commit | 785063e02bb249ef3a39db88575fe626b310d4a7 (patch) | |
tree | b23673aef74184f0413ee71044df6034ec08aab6 /git-sh-setup.sh | |
parent | d0f1ea6003d97e63110fa7d50bb07f546a909b6e (diff) | |
download | git-785063e02bb249ef3a39db88575fe626b310d4a7.tar.gz |
sh-setup: protect from exported IFS
Many scripted Porcelains rely on being able to split words at the
default $IFS characters, i.e. SP, HT and LF. If the user exports a
non-default IFS to the environment, what they read from plumbing
commands such as ls-files that use HT to delimit fields may not be
split in the way we expect.
Protect outselves by resetting it, just like we do so against CDPATH
exported to the environment.
Noticed by Andrew Dranse <adranse@oanda.com>.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-sh-setup.sh')
-rw-r--r-- | git-sh-setup.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 5d8e4e6c89..69472e4125 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -9,8 +9,12 @@ # you would cause "cd" to be taken to unexpected places. If you # like CDPATH, define it for your interactive shell sessions without # exporting it. +# But we protect ourselves from such a user mistake nevertheless. unset CDPATH +# Similarly for IFS +unset IFS + git_broken_path_fix () { case ":$PATH:" in *:$1:*) : ok ;; |