Validate validates fields of branch
()
| 39 | |
| 40 | // Validate validates fields of branch |
| 41 | func (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 | |
| 60 | func (b *Branch) marshal() *format.Subsection { |
| 61 | if b.raw == nil { |