Unset GIT_ASKPASS in tests that assume it is unset #1505
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.
Two of the askpass tests assume
GIT_ASKPASS
is not set. Before this change, they wrongly fail when it is set, even if the code under test is working correctly.ssh_askpass_is_used_as_fallback
ssh_askpass_does_not_override_current_value
As other tests that deliberately involve
GIT_ASKPASS
(and therefore do not need to be modified) attest, when it is set:SSH_ASKPASS
is not used as a fallback (GIT_ASKPASS
deliberately takes precedence).Although
SSH_ASKPASS
still does not override the current value,GIT_ASKPASS
does override it, so checking for equality to the current value fails.Since those test cases are among those that already have the
serial
attribute and already temporarily modify the environment, this extends that modification by having it also temporarily unsetGIT_ASKPASS
if it was set.An alternative fix could be to pass
false
as the first argument toapply_environment
, so thatGIT_ASKPASS
is not considered. Which of these approaches is better may depend on exactly what behavior we are trying to test. (Maybe even two more test cases should be added, to test it both ways.)Situations where
GIT_ASKPASS
is set include dev containers. I discovered this bug while running tests in the dev container environment added in #1502, where all tests passed except the two mentioned above:All other tests passed already, and all tests pass with this change.