diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2021-06-22 16:43:46 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2021-06-22 16:43:46 +0300 |
commit | 65bddca7ed089abdc7869c0f500825f29bd5a89f (patch) | |
tree | ca0085ae137aa04d7c926e59e0a9c75dcde54880 | |
parent | b45930fbe3ef812f226983b48ed93d908b5eac3a (diff) | |
parent | be8a34e94f5bcf4003fe3d0c4d468a1113d4de03 (diff) |
Merge branch 'zj-internal-ref-prefix' into 'master'
receive.hideRefs use InternalRefPrefixes
See merge request gitlab-org/gitaly!3608
-rw-r--r-- | internal/git/command_description.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/git/command_description.go b/internal/git/command_description.go index faed63717..784fd70df 100644 --- a/internal/git/command_description.go +++ b/internal/git/command_description.go @@ -138,7 +138,7 @@ var commandDescriptions = map[string]commandDescription{ }, "receive-pack": { flags: 0, - opts: []GlobalOption{ + opts: append([]GlobalOption{ // In case the repository belongs to an object pool, we want to prevent // Git from including the pool's refs in the ref advertisement. We do // this by rigging core.alternateRefsCommand to produce no output. @@ -161,17 +161,7 @@ var commandDescriptions = map[string]commandDescription{ // Make git-receive-pack(1) advertise the push options // capability to clients. ConfigPair{Key: "receive.advertisePushOptions", Value: "true"}, - - // Hide several reference spaces from being displayed on pushes. This has - // two outcomes: first, we reduce the initial ref advertisement and should - // speed up pushes for repos which have loads of merge requests, pipelines - // and environments. Second, this also prohibits clients to update or delete - // these refs. - ConfigPair{Key: "receive.hideRefs", Value: "refs/environments/"}, - ConfigPair{Key: "receive.hideRefs", Value: "refs/keep-around/"}, - ConfigPair{Key: "receive.hideRefs", Value: "refs/merge-requests/"}, - ConfigPair{Key: "receive.hideRefs", Value: "refs/pipelines/"}, - }, + }, hiddenReceivePackRefPrefixes()...), }, "remote": { flags: scNoEndOfOptions, @@ -337,3 +327,13 @@ func validatePositionalArg(arg string) error { } return nil } + +func hiddenReceivePackRefPrefixes() []GlobalOption { + var cps []GlobalOption + + for _, ns := range InternalRefPrefixes { + cps = append(cps, ConfigPair{Key: "receive.hideRefs", Value: ns}) + } + + return cps +} |