sh-setup: work around "unset IFS" bug in some shells
With an unset IFS, field splitting is supposed to act as if IFS is set to the usual SP HT LF, but Marc Branchaud reports that the shell on FreeBSD 7.2 gets this wrong. It is easy to set it to the default value manually, and it is also safer in case somebody tries to save the old value away and restore, e.g. $oIFS=$IFS IFS=something ... IFS=$oIFS while forgetting that the original IFS might be unset (which can be coded but would be more involved). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 7, 2012 at 14:31 UTC
393050c32b58dceef8706d389abe3793fbac51ae
1 file changed
+5
-2
git-sh-setup.sh
+5
-2
@@ -12,8 +12,11 @@
12
# But we protect ourselves from such a user mistake nevertheless.
13
unset CDPATH
14
15
-# Similarly for IFS
16
-unset IFS
15
+# Similarly for IFS, but some shells (e.g. FreeBSD 7.2) are buggy and
16
+# do not equate an unset IFS with IFS with the default, so here is
17
+# an explicit SP HT LF.
18
+IFS='
19
+'
20
21
git_broken_path_fix () {
22
case ":$PATH:" in