summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-08-08 19:08:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-08-08 21:36:33 (GMT)
commit785063e02bb249ef3a39db88575fe626b310d4a7 (patch)
treeb23673aef74184f0413ee71044df6034ec08aab6 /git-sh-setup.sh
parentd0f1ea6003d97e63110fa7d50bb07f546a909b6e (diff)
downloadgit-785063e02bb249ef3a39db88575fe626b310d4a7.zip
git-785063e02bb249ef3a39db88575fe626b310d4a7.tar.gz
git-785063e02bb249ef3a39db88575fe626b310d4a7.tar.bz2
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.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 5d8e4e6..69472e4 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 ;;