blob: 476454c94ac1abcbe2f5bed71d5d25674d8f650c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//go:build static && system_libgit2 && gitaly_test
// +build static,system_libgit2,gitaly_test
package main
import (
"context"
"encoding/gob"
"flag"
"gitlab.com/gitlab-org/gitaly/v15/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag"
)
// This subcommand is only called in tests, so we don't want to register it like
// the other subcommands but instead will do it in an init block. The test build
// flag will guarantee that this is not built and registered in the
// gitaly-git2go binary
func init() {
subcommands["feature-flags"] = &featureFlagsSubcommand{}
}
type featureFlagsSubcommand struct{}
func (featureFlagsSubcommand) Flags() *flag.FlagSet {
return flag.NewFlagSet("feature-flags", flag.ExitOnError)
}
func (featureFlagsSubcommand) Run(ctx context.Context, decoder *gob.Decoder, encoder *gob.Encoder) error {
rawFlags := featureflag.RawFromContext(ctx)
return encoder.Encode(git2go.FeatureFlags{
Raw: rawFlags,
})
}
|