shlib.sh: improve handling of exporting of GIT_XXX variables