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

Method Branch

repository.go:689–701  ·  view source on GitHub ↗

Branch return a Branch if exists

(name string)

Source from the content-addressed store, hash-verified

687
688// Branch return a Branch if exists
689func (r *Repository) Branch(name string) (*config.Branch, error) {
690 cfg, err := r.Config()
691 if err != nil {
692 return nil, err
693 }
694
695 b, ok := cfg.Branches[name]
696 if !ok {
697 return nil, ErrBranchNotFound
698 }
699
700 return b, nil
701}
702
703// CreateBranch creates a new Branch
704func (r *Repository) CreateBranch(c *config.Branch) error {

Callers 3

TestBranchInvalidMethod · 0.80
TestDeleteBranchMethod · 0.80

Calls 1

ConfigMethod · 0.95

Tested by 3

TestBranchInvalidMethod · 0.64
TestDeleteBranchMethod · 0.64