Use node process environment variables as base for overridden git process environment
Opened this issue · 0 comments
steveukx commented
Currently when simpleGit
is configured with an override for a single environment variable:
const git = simpleGit().env('A', 'aaa');
The git
child process will be called with an environment of only that override, whereas the default would be to use the process.environment
from the containing node
process.
This might be intentional, especially in the case of using an object form:
const git = simpleGit().env({ ...process.env, 'A': 'aaa' });
But to allow for more flexibility and cleaner calling code, there should be a constructor plugin to allow opting in / out of this behaviour, eg:
const git = simpleGit({ env: { inherit: true } }).env('A', 'aaa');
Would cause the git
child process to be called with the current state of the process.env
object as a base, overridden with the explicitly configured {A: 'aaa'}
.