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'}.
Currently when
simpleGitis configured with an override for a single environment variable:The
gitchild process will be called with an environment of only that override, whereas the default would be to use theprocess.environmentfrom the containingnodeprocess.This might be intentional, especially in the case of using an object form:
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:
Would cause the
gitchild process to be called with the current state of theprocess.envobject as a base, overridden with the explicitly configured{A: 'aaa'}.