|
|
@ -86,8 +86,8 @@ type DeleteBranchOptions struct { |
|
|
|
Force bool |
|
|
|
Force bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DeleteBranch delete a branch by name on repository.
|
|
|
|
// DeleteBranch deletes a branch from given repository path.
|
|
|
|
func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) error { |
|
|
|
func DeleteBranch(repoPath, name string, opts DeleteBranchOptions) error { |
|
|
|
cmd := NewCommand("branch") |
|
|
|
cmd := NewCommand("branch") |
|
|
|
|
|
|
|
|
|
|
|
if opts.Force { |
|
|
|
if opts.Force { |
|
|
@ -97,11 +97,16 @@ func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) erro |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cmd.AddArguments(name) |
|
|
|
cmd.AddArguments(name) |
|
|
|
_, err := cmd.RunInDir(repo.Path) |
|
|
|
_, err := cmd.RunInDir(repoPath) |
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteBranch deletes a branch from repository.
|
|
|
|
|
|
|
|
func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) error { |
|
|
|
|
|
|
|
return DeleteBranch(repo.Path, name, opts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// AddRemote adds a new remote to repository.
|
|
|
|
// AddRemote adds a new remote to repository.
|
|
|
|
func (repo *Repository) AddRemote(name, url string, fetch bool) error { |
|
|
|
func (repo *Repository) AddRemote(name, url string, fetch bool) error { |
|
|
|
cmd := NewCommand("remote", "add") |
|
|
|
cmd := NewCommand("remote", "add") |
|
|
|