diff options
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 12 | ||||
-rw-r--r-- | pkg/commands/git_test.go | 2 | ||||
-rw-r--r-- | pkg/commands/os.go | 5 |
3 files changed, 13 insertions, 6 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index bf9aa6646..14f3a433a 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -7,7 +7,7 @@ import ( "os/exec" "strings" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/utils" gitconfig "github.com/tcnksm/go-gitconfig" @@ -223,8 +223,14 @@ func (c *GitCommand) NewBranch(name string) error { } // DeleteBranch delete branch -func (c *GitCommand) DeleteBranch(branch string) error { - return c.OSCommand.RunCommand("git branch -d " + branch) +func (c *GitCommand) DeleteBranch(branch string, force bool) error { + var command string + if force { + command = "git branch -D " + } else { + command = "git branch -d " + } + return c.OSCommand.RunCommand(command + branch) } // ListStash list stash diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 9c2a64330..c930f76eb 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "github.com/jesseduffield/lazygit/pkg/test" ) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 9756d619d..1eef36151 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -11,7 +11,7 @@ import ( "github.com/mgutz/str" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" gitconfig "github.com/tcnksm/go-gitconfig" ) @@ -175,7 +175,8 @@ func (c *OSCommand) Unquote(message string) string { return message } -func (C *OSCommand) AppendLineToFile(filename, line string) error { +// AppendLineToFile adds a new line in file +func (c *OSCommand) AppendLineToFile(filename, line string) error { f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) if err != nil { return err |