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

Method Validate

options.go:370–384  ·  view source on GitHub ↗

Validate validates the fields and sets the default values.

()

Source from the content-addressed store, hash-verified

368
369// Validate validates the fields and sets the default values.
370func (o *CheckoutOptions) Validate() error {
371 if !o.Create && !o.Hash.IsZero() && o.Branch != "" {
372 return ErrBranchHashExclusive
373 }
374
375 if o.Create && o.Branch == "" {
376 return ErrCreateRequiresBranch
377 }
378
379 if o.Branch == "" {
380 o.Branch = plumbing.Master
381 }
382
383 return nil
384}
385
386// ResetMode defines the mode of a reset operation.
387type ResetMode int8

Callers

nothing calls this directly

Calls 1

IsZeroMethod · 0.65

Tested by

no test coverage detected