shlib.sh: be more tolerant of broken /bin/sh implementations
Some broken /bin/sh implementations fail to properly export variables
into the environment when a command like:
ENV=val cmd
is run where cmd is a shell function. The variables will have the
new value, but will not be exported which means that any external
commands run by the shell function will not see them.
Work around this problem by exporting the two Git variables we care
about if they are set and make the git function definition a subshell
instead of a group so the export is temporary.