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

Method Validate

config/config.go:599–619  ·  view source on GitHub ↗

Validate validates the fields and sets the default values.

()

Source from the content-addressed store, hash-verified

597
598// Validate validates the fields and sets the default values.
599func (c *RemoteConfig) Validate() error {
600 if c.Name == "" {
601 return ErrRemoteConfigEmptyName
602 }
603
604 if len(c.URLs) == 0 {
605 return ErrRemoteConfigEmptyURL
606 }
607
608 for _, r := range c.Fetch {
609 if err := r.Validate(); err != nil {
610 return err
611 }
612 }
613
614 if len(c.Fetch) == 0 {
615 c.Fetch = []RefSpec{RefSpec(fmt.Sprintf(DefaultFetchRefSpec, c.Name))}
616 }
617
618 return plumbing.NewRemoteHEADReferenceName(c.Name).Validate()
619}
620
621func (c *RemoteConfig) unmarshal(s *format.Subsection) error {
622 c.raw = s

Calls 3

RefSpecTypeAlias · 0.85
ValidateMethod · 0.45