summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-12-07 22:31:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-10 21:27:16 (GMT)
commit393050c32b58dceef8706d389abe3793fbac51ae (patch)
tree2e7413f00106d8a105f2b291e7d1b4f7d8ad019d
parenta859d3ee57acee1ca9fbb37e763814f83d11e7bd (diff)
downloadgit-393050c32b58dceef8706d389abe3793fbac51ae.zip
git-393050c32b58dceef8706d389abe3793fbac51ae.tar.gz
git-393050c32b58dceef8706d389abe3793fbac51ae.tar.bz2
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>
-rw-r--r--git-sh-setup.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ee0e0bc..107c144 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -12,8 +12,11 @@
# But we protect ourselves from such a user mistake nevertheless.
unset CDPATH
-# Similarly for IFS
-unset IFS
+# Similarly for IFS, but some shells (e.g. FreeBSD 7.2) are buggy and
+# do not equate an unset IFS with IFS with the default, so here is
+# an explicit SP HT LF.
+IFS='
+'
git_broken_path_fix () {
case ":$PATH:" in