Clarify USE_SHELL
warning helper signature
#2045
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.
This is a minor refactor of how
_warn_use_shell
can be, and is, invoked.The
_warn_use_shell
helper function ingit.cmd
takes a singlebool
-valued argumentextra_danger
, which is conceptually associated with having aTrue
value ofUSE_SHELL
, but the association is not necessarily obvious. Specifically:USE_SHELL
on theGit
class or through an instance,extra_danger
is alwaysFalse
. This is so even if theUSE_SHELL
value is currentlyTrue
, because the danger that arises fromTrue
occurs internally.USE_SHELL
, which can only be done on theGit
class and not on or through an instance,extra_danger
is the value set for the attribute. This is because settingUSE_SHELL
toTrue
incurs the danger described in #1896.When reading the code, which passed
extra_danger
positionally, the meaning of the parameter may not always have been obvious.This makes the
extra_danger
parameter keyword-only, and passes it by keyword in all invocations, so that its meaning is clearer.