Fix CI by enabling Git protocol v2 #5353
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.
Some time back, Git added support for protocol version 2 over HTTP. This is announced by the
Git-Protocolheader, the value of which Git expects to see as theGIT_PROTOCOLenvironment variable. If it receives that value, then it switches into protocol v2 mode.While this is a nice to have in general, it's presently important to fix our testsuite in CI when testing in SHA-256 mode. In that mode, we set
GIT_DEFAULT_HASH=sha256to specify the default hash algorithm. In protocols v0 and v1, Git does not send a capabilities line by default (although one is accepted) in an empty repository, and if no such line is present, it's not possible to discern the hash algorithm in use.Git recently (after 2.40) added a patch that resulted in empty repositories that are cloned not honouring
GIT_DEFAULT_HASHin such a case, so if no refs are set, we end up with a SHA-1 repository, which makes our tests fail since they don't interoperate. This will likely be fixed upstream by both announcing a dummy capabilities line like for pushes and by restoring the use ofGIT_DEFAULT_HASHwhen no hash algorithm can be explicitly determined.In any event, none of this matters with protocol v2, since in that case capabilities are sent as part of the initial refs request and we always know the hash algorithm. Since this will always work for affected Git versions, let's make sure we enable protocol v2 in the test server if the client supports it.
Fixes #5352