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

Method Validate

config/branch.go:41–58  ·  view source on GitHub ↗

Validate validates fields of branch

()

Source from the content-addressed store, hash-verified

39
40// Validate validates fields of branch
41func (b *Branch) Validate() error {
42 if b.Name == "" {
43 return errBranchEmptyName
44 }
45
46 if b.Merge != "" && !b.Merge.IsBranch() {
47 return errBranchInvalidMerge
48 }
49
50 if b.Rebase != "" &&
51 b.Rebase != "true" &&
52 b.Rebase != "interactive" &&
53 b.Rebase != "false" {
54 return errBranchInvalidRebase
55 }
56
57 return plumbing.NewBranchReferenceName(b.Name).Validate()
58}
59
60func (b *Branch) marshal() *format.Subsection {
61 if b.raw == nil {

Callers 3

unmarshalMethod · 0.95
TestValidateNameMethod · 0.95
TestValidateMergeMethod · 0.95

Calls 2

NewBranchReferenceNameFunction · 0.92
IsBranchMethod · 0.80

Tested by 2

TestValidateNameMethod · 0.76
TestValidateMergeMethod · 0.76