MCPcopy
hub / github.com/go-git/go-git / Validate

Method Validate

options.go:454–470  ·  view source on GitHub ↗

Validate validates the fields and sets the default values.

(r *Repository)

Source from the content-addressed store, hash-verified

452
453// Validate validates the fields and sets the default values.
454func (o *ResetOptions) Validate(r *Repository) error {
455 if o.Commit == plumbing.ZeroHash {
456 ref, err := r.Head()
457 if err != nil {
458 return err
459 }
460
461 o.Commit = ref.Hash()
462 } else {
463 _, err := r.CommitObject(o.Commit)
464 if err != nil {
465 return fmt.Errorf("invalid reset option: %w", err)
466 }
467 }
468
469 return nil
470}
471
472type LogOrder int8
473

Callers 1

Calls 3

HeadMethod · 0.80
CommitObjectMethod · 0.80
HashMethod · 0.65

Tested by 1