Add support for wwwauth[] to credential helpers
#5381
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.
Git recently added a new field to the credential helper,
wwwauth[], which may be repeated and includes all of theWWW-Authenticateheaders so that the credential helper may choose an appropriate set of credentials and extract any sort of necessary data from the field (such as challenge).In Git LFS, we also want to do this with the
LFS-Authenticateheaders as well, since those are often used for the same purpose, so include both these headers in that field when passing them togit credential fill.Note that
git credential fillonly honours this value and passes it to the credential helper in Git 2.41 and newer (including the latestHEAD). However, just to be safe, let's add an undocumented and experimental option (credential.*.skipwwwauth) that users can use to control this, which we can remove in a few releases if it turns out it's not needed. Similarly, skip our new tests if we have an older version of Git where this doesn't work, since they'll otherwise fail.In addition, perform some preparatory work to allow multiple values for a key, which we'll use in the second commit.
Fixes: #5222