Skip to content

Commit 785063e

Browse files
committed
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 <[email protected]>. Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0f1ea6 commit 785063e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git-sh-setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
# you would cause "cd" to be taken to unexpected places. If you
1010
# like CDPATH, define it for your interactive shell sessions without
1111
# exporting it.
12+
# But we protect ourselves from such a user mistake nevertheless.
1213
unset CDPATH
1314

15+
# Similarly for IFS
16+
unset IFS
17+
1418
git_broken_path_fix () {
1519
case ":$PATH:" in
1620
*:$1:*) : ok ;;

0 commit comments

Comments
 (0)