diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2021-06-21 12:46:11 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2021-06-21 14:20:37 +0300 |
commit | be8a34e94f5bcf4003fe3d0c4d468a1113d4de03 (patch) | |
tree | 6db64feb96b4e2c8b0566f8721cb9f192cb52592 | |
parent | 53004e6abf23e7309a50231aa46f739e7978c7f9 (diff) |
receive.hideRefs use InternalRefPrefixes
Leverage a general up to date list to inject receive.hideRefs config
pairs. This removes confusion if the list is correct.
-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 +} |