blob: 1a2bede7ac476f571e1fdd484773f12c72cc297b (
about) (
plain) (
blame)
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
36
37
|
package name
import "fmt"
const (
nameAllowOneLevel = 1 << iota
nameRefspecPattern
)
// Options controls Git name validation.
type Options struct {
// AllowOneLevel permits one-component names like HEAD.
AllowOneLevel bool
// RefspecPattern permits a '*' anywhere in the name.
RefspecPattern bool
}
// String returns a text form of the options.
//
// This is mainly just for tests.
func (options Options) String() string {
return fmt.Sprintf("allow_onelevel=%t,refspec_pattern=%t", options.AllowOneLevel, options.RefspecPattern)
}
func (options Options) flags() int {
var flags int
if options.AllowOneLevel {
flags |= nameAllowOneLevel
}
if options.RefspecPattern {
flags |= nameRefspecPattern
}
return flags
}
|