Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/bundleuri/git_config.go')
-rw-r--r--internal/bundleuri/git_config.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/bundleuri/git_config.go b/internal/bundleuri/git_config.go
index 747a99bf2..5eb809480 100644
--- a/internal/bundleuri/git_config.go
+++ b/internal/bundleuri/git_config.go
@@ -11,10 +11,12 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/log"
)
-// InfoRefsGitConfig return a slice of git.ConfigPairs you can inject into the
-// call to git-upload-pack(1) --advertise-refs, to advertise the use of
-// bundle-URI to the client who clones/fetches from the repository.
-func InfoRefsGitConfig(ctx context.Context) []git.ConfigPair {
+// CapabilitiesGitConfig returns a slice of git.ConfigPairs that can be injected
+// into the Git config to make it aware the bundle-URI capabilities are
+// supported.
+// This can be used when spawning git-upload-pack(1) --advertise-refs in
+// response to the GET /info/refs request.
+func CapabilitiesGitConfig(ctx context.Context) []git.ConfigPair {
if featureflag.BundleURI.IsDisabled(ctx) {
return []git.ConfigPair{}
}
@@ -30,8 +32,6 @@ func InfoRefsGitConfig(ctx context.Context) []git.ConfigPair {
// UploadPackGitConfig return a slice of git.ConfigPairs you can inject into the
// call to git-upload-pack(1) to advertise the available bundle to the client
// who clones/fetches from the repository.
-// In case no backups could be found or something else goes wrong, an empty
-// slice is returned without error.
func UploadPackGitConfig(
ctx context.Context,
backupLocator backup.Locator,
@@ -39,12 +39,12 @@ func UploadPackGitConfig(
repo storage.Repository,
) []git.ConfigPair {
if backupLocator == nil || backupSink == nil || featureflag.BundleURI.IsDisabled(ctx) {
- return []git.ConfigPair{}
+ return CapabilitiesGitConfig(ctx)
}
theBackup, err := backupLocator.FindLatest(ctx, repo)
if err != nil {
- return []git.ConfigPair{}
+ return CapabilitiesGitConfig(ctx)
}
for _, step := range theBackup.Steps {
@@ -55,7 +55,7 @@ func UploadPackGitConfig(
uri, err := backupSink.SignedURL(ctx, step.BundlePath, 10*time.Minute)
if err != nil {
- return []git.ConfigPair{}
+ return CapabilitiesGitConfig(ctx)
}
log.AddFields(ctx, log.Fields{"bundle_uri": true})
@@ -80,5 +80,5 @@ func UploadPackGitConfig(
}
}
- return []git.ConfigPair{}
+ return CapabilitiesGitConfig(ctx)
}