DeleteBranch delete a Branch from the repository and delete the config
(name string)
| 721 | |
| 722 | // DeleteBranch delete a Branch from the repository and delete the config |
| 723 | func (r *Repository) DeleteBranch(name string) error { |
| 724 | cfg, err := r.Config() |
| 725 | if err != nil { |
| 726 | return err |
| 727 | } |
| 728 | |
| 729 | if _, ok := cfg.Branches[name]; !ok { |
| 730 | return ErrBranchNotFound |
| 731 | } |
| 732 | |
| 733 | delete(cfg.Branches, name) |
| 734 | return r.Storer.SetConfig(cfg) |
| 735 | } |
| 736 | |
| 737 | // CreateTag creates a tag. If opts is included, the tag is an annotated tag, |
| 738 | // otherwise a lightweight tag is created. |