MCPcopy Create free account
hub / github.com/go-git/go-git / Validate

Method Validate

config/refspec.go:32–50  ·  view source on GitHub ↗

Validate validates the RefSpec

()

Source from the content-addressed store, hash-verified

30
31// Validate validates the RefSpec
32func (s RefSpec) Validate() error {
33 spec := string(s)
34 if strings.Count(spec, refSpecSeparator) != 1 {
35 return ErrRefSpecMalformedSeparator
36 }
37
38 sep := strings.Index(spec, refSpecSeparator)
39 if sep == len(spec)-1 {
40 return ErrRefSpecMalformedSeparator
41 }
42
43 ws := strings.Count(spec[0:sep], refSpecWildcard)
44 wd := strings.Count(spec[sep+1:], refSpecWildcard)
45 if ws == wd && ws < 2 && wd < 2 {
46 return nil
47 }
48
49 return ErrRefSpecMalformedWildcard
50}
51
52// IsForceUpdate returns if update is allowed in non fast-forward merges.
53func (s RefSpec) IsForceUpdate() bool {

Callers

nothing calls this directly

Calls 2

CountMethod · 0.65
IndexMethod · 0.65

Tested by

no test coverage detected