DeleteRemote delete a remote from the repository and delete the config
(name string)
| 672 | |
| 673 | // DeleteRemote delete a remote from the repository and delete the config |
| 674 | func (r *Repository) DeleteRemote(name string) error { |
| 675 | cfg, err := r.Config() |
| 676 | if err != nil { |
| 677 | return err |
| 678 | } |
| 679 | |
| 680 | if _, ok := cfg.Remotes[name]; !ok { |
| 681 | return ErrRemoteNotFound |
| 682 | } |
| 683 | |
| 684 | delete(cfg.Remotes, name) |
| 685 | return r.Storer.SetConfig(cfg) |
| 686 | } |
| 687 | |
| 688 | // Branch return a Branch if exists |
| 689 | func (r *Repository) Branch(name string) (*config.Branch, error) { |