smarthttp: Fix upload-pack using bundle-URI with missing backup
When bundleuri.UploadPackGitConfig()
returns an empty slice, we see
the PostUploadPackWithSidechannel
RPC fail with FailedPrecondition
.
The git-upload-pack(1) process started here quits with the error:
fatal: invalid command 'bundle-uri'
Looking at the source code of Git, we see when git-upload-pack(1)
receives the 'bundle-uri' command, it checks if the that capability
should be advertised. To query for this, Git checks if the config
uploadpack.advertiseBundleURIs
is set to true
. When Gitaly could not
build a bundle URI to pass to the git-upload-pack(1), this config was
not set, and Git did not accept this command.
For the SmartHTTP protocol Gitaly uses separate processes to handle
'GET info/refs' and 'POST upload-pack', using option --stateless-rpc
.
Due to this, the server advertised to the client it supports
'bundle-uri' in the 'GET info/refs' response, but in the consecutive
requests we might spawn git-upload-pack(1) without this config, and Git
will not accept the 'bundle-uri' command.
Inject the config uploadpack.advertiseBundleURIs=true
into all calls
to git-upload-pack(1), even when the bundle-URI cannot be built.
Fixes: #5740 (closed)