diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-25 11:02:46 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-25 11:02:46 +1000 |
commit | f24c95aedec785985dfcd98ff3997152c193bd3e (patch) | |
tree | 9f8ac1a61cf686052f623b767e13d6d1a14e3683 /pkg/commands | |
parent | 5628eae502ee3b4d3d72a8e4045713b637f7a764 (diff) | |
parent | 93ab892bdd1226f9a519a938c8b28590e71e54f3 (diff) |
Merge branch 'master' into feature/auto-updates
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 |