fix: Do not enable export when sourcing rc file #553
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Doesn't close any issue.
⚡ Summary
There's currently a discrepancy with the documentation on rc files and the actual behavior.
The documentation states:
However,
set -a
is not set by default (or at all in most people's configurations) in~/.profile
,~/.bashrc
, etc. If that were the case, then way too many environment variables would be added to the environment table of all child processes.The correct behavior is already hinted at with the examples:
The
export
syntax is used, which implies thatset -a
is not enabled. Furthermore, when sourcing"$NVM_DIR/nvm.sh"
, we wouldn't want all the regular variables (not environment variables) it defines to be loaded in as environment variables - again this behavior is different from standard rc files and is unintuitive. Other hook managers like Husky act like this.This is a breaking change, but is in line with user expectations, the current documentation, and other popular Git hook managers.
This also adds documentation to make it clear how to properly use
rc
field when path contains spaces.☑️ Checklist