Skip to content

Commit

Permalink
sh-setup: protect from exported IFS
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Aug 8, 2012
1 parent d0f1ea6 commit 785063e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions git-sh-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down

0 comments on commit 785063e

Please sign in to comment.