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 <adranse@oanda.com>. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d0f1ea6003
commit
785063e02b
@ -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 ;;
|
||||
|
Loading…
Reference in New Issue
Block a user