diff options
| author | 2026-03-26 09:19:01 +0000 | |
|---|---|---|
| committer | 2026-03-26 09:19:01 +0000 | |
| commit | 929b8cc620abca70b3444b09be5249f6c6cb7812 (patch) | |
| tree | 29b1edba8f597d09a2a51a6b2c901389cc40e242 /ref/name/options.go | |
| parent | format: Move commitgraph and packfile here (diff) | |
| signature | No signature | |
ref/name: Rename from ref/refname
Diffstat (limited to 'ref/name/options.go')
| -rw-r--r-- | ref/name/options.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ref/name/options.go b/ref/name/options.go new file mode 100644 index 00000000..5ae81541 --- /dev/null +++ b/ref/name/options.go @@ -0,0 +1,30 @@ +package refname + +import "fmt" + +// Options controls Git refname validation. +type Options struct { + // AllowOneLevel permits one-component refnames like HEAD. + AllowOneLevel bool + + // RefspecPattern permits one '*' anywhere in the refname. + RefspecPattern bool +} + +// String returns one stable text form of the options. +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 |= refnameAllowOneLevel + } + + if options.RefspecPattern { + flags |= refnameRefspecPattern + } + + return flags +} |
