Skip to content

Commit

Permalink
Fix branch deletion with git < 2.5.0 (go-gitea#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
lafriks authored and appleboy committed Aug 3, 2017
1 parent fc63966 commit 479f87e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions repo_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ type DeleteBranchOptions struct {

// DeleteBranch delete a branch by name on repository.
func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) error {
cmd := NewCommand("branch", "-d")
cmd := NewCommand("branch")

if opts.Force {
cmd.AddArguments("-f")
cmd.AddArguments("-D")
} else {
cmd.AddArguments("-d")
}

cmd.AddArguments(name)
Expand Down

0 comments on commit 479f87e

Please sign in to comment.