From 5a3c95dd3c80dbbe58fb8971aa514c06bfb893d8 Mon Sep 17 00:00:00 2001 From: John Cai Date: Mon, 18 Jul 2022 15:57:53 -0400 Subject: git: Hide refs for upload-pack Currently we are relying on an omnibus setting that sets a git config value to hide certain hidden refs during transfer. However, we no longer want to rely on git config files that are external to Gitaly but rather inject config values we need directly into the command. We already do this for receive-pack but not for upload-pack. Add the corresponding config for upload-pack. Changelog: changed --- internal/git/command_description.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/git/command_description.go b/internal/git/command_description.go index a56580e0b..9ac0b841e 100644 --- a/internal/git/command_description.go +++ b/internal/git/command_description.go @@ -299,12 +299,12 @@ var commandDescriptions = map[string]commandDescription{ }, "upload-pack": { flags: scNoRefUpdates, - opts: append([]GlobalOption{ + opts: append(append([]GlobalOption{ ConfigPair{Key: "uploadpack.allowFilter", Value: "true"}, // Enables the capability to request individual SHA1's from the // remote repo. ConfigPair{Key: "uploadpack.allowAnySHA1InWant", Value: "true"}, - }, packConfiguration()...), + }, hiddenUploadPackRefPrefixes()...), packConfiguration()...), }, "version": { flags: scNoRefUpdates, @@ -413,6 +413,16 @@ func hiddenReceivePackRefPrefixes() []GlobalOption { return cps } +func hiddenUploadPackRefPrefixes() []GlobalOption { + var cps []GlobalOption + + for _, ns := range InternalRefPrefixes { + cps = append(cps, ConfigPair{Key: "uploadpack.hideRefs", Value: ns}) + } + + return cps +} + // fsckConfiguration generates our fsck configuration, including ignored checks. The prefix must // either be "receive" or "fetch" and indicates whether it should apply to git-receive-pack(1) or to // git-fetch-pack(1). -- cgit v1.2.3