From 785063e02bb249ef3a39db88575fe626b310d4a7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 8 Aug 2012 12:08:17 -0700 Subject: [PATCH] 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 . Signed-off-by: Junio C Hamano --- git-sh-setup.sh | 4 ++++ 1 file changed, 4 insertions(+) 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 ;; -- 2.11.4.GIT