Skip to content
Snippets Groups Projects

Bundle-uri capability: Only advertise when bundle exist

Merged Olivier Campeau requested to merge advertise-bundle-uri into master
All threads resolved!
Files
7
@@ -3,9 +3,9 @@ package bundleuri
import (
"context"
"fmt"
"gitlab.com/gitlab-org/gitaly/v16/internal/featureflag"
"strconv"
"gitlab.com/gitlab-org/gitaly/v16/internal/featureflag"
"gitlab.com/gitlab-org/gitaly/v16/internal/git/gitcmd"
)
@@ -21,18 +21,15 @@ import (
// This function is also used when spawning git-upload-pack(1) --advertise-refs in
// response to the GET /info/refs request.
func CapabilitiesGitConfig(ctx context.Context, enable bool) []gitcmd.ConfigPair {
cfg := func(enable bool) []gitcmd.ConfigPair {
return []gitcmd.ConfigPair{
{
Key: "uploadpack.advertiseBundleURIs",
Value: strconv.FormatBool(enable),
},
}
cfg := gitcmd.ConfigPair{
Key: "uploadpack.advertiseBundleURIs",
Value: strconv.FormatBool(enable),
}
if featureflag.BundleURI.IsDisabled(ctx) {
return cfg(false)
cfg.Value = strconv.FormatBool(false)
}
return cfg(enable)
return []gitcmd.ConfigPair{cfg}
}
// UploadPackGitConfig return a slice of gitcmd.ConfigPairs you can inject into the
@@ -40,7 +37,7 @@ func CapabilitiesGitConfig(ctx context.Context, enable bool) []gitcmd.ConfigPair
// who clones/fetches from the repository.
func UploadPackGitConfig(ctx context.Context, signedURL string) []gitcmd.ConfigPair {
if featureflag.BundleURI.IsDisabled(ctx) || signedURL == "" {
return []gitcmd.ConfigPair{}
return CapabilitiesGitConfig(ctx, false)
}
config := []gitcmd.ConfigPair{
Loading