summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gopkg.lock2
-rw-r--r--docs/Keybindings.md1
-rw-r--r--pkg/app/app.go2
-rw-r--r--pkg/commands/git.go12
-rw-r--r--pkg/commands/git_test.go2
-rw-r--r--pkg/commands/os.go5
-rw-r--r--pkg/config/app_config.go10
-rw-r--r--pkg/git/branch_list_builder.go2
-rw-r--r--pkg/gui/branches_panel.go21
-rw-r--r--pkg/gui/gui.go2
-rw-r--r--pkg/gui/keybindings.go1
-rw-r--r--pkg/i18n/dutch.go8
-rw-r--r--pkg/i18n/english.go8
-rw-r--r--pkg/i18n/i18n.go2
-rw-r--r--pkg/i18n/i18n_test.go6
-rw-r--r--pkg/test/test.go16
-rw-r--r--vendor/github.com/sirupsen/logrus/LICENSE (renamed from vendor/github.com/Sirupsen/logrus/LICENSE)0
-rw-r--r--vendor/github.com/sirupsen/logrus/alt_exit.go (renamed from vendor/github.com/Sirupsen/logrus/alt_exit.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/doc.go (renamed from vendor/github.com/Sirupsen/logrus/doc.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/entry.go (renamed from vendor/github.com/Sirupsen/logrus/entry.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/exported.go (renamed from vendor/github.com/Sirupsen/logrus/exported.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/formatter.go (renamed from vendor/github.com/Sirupsen/logrus/formatter.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/hooks.go (renamed from vendor/github.com/Sirupsen/logrus/hooks.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/json_formatter.go (renamed from vendor/github.com/Sirupsen/logrus/json_formatter.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/logger.go (renamed from vendor/github.com/Sirupsen/logrus/logger.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/logrus.go (renamed from vendor/github.com/Sirupsen/logrus/logrus.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/terminal_bsd.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_bsd.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/terminal_check_appengine.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/terminal_linux.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_linux.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/text_formatter.go (renamed from vendor/github.com/Sirupsen/logrus/text_formatter.go)0
-rw-r--r--vendor/github.com/sirupsen/logrus/writer.go (renamed from vendor/github.com/Sirupsen/logrus/writer.go)0
32 files changed, 68 insertions, 32 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index 9c715f884..876ea675e 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -2,7 +2,7 @@
[[projects]]
- name = "github.com/Sirupsen/logrus"
+ name = "github.com/sirupsen/logrus"
packages = ["."]
revision = "3e01752db0189b9157070a0e1668a620f9a85da2"
version = "v1.0.6"
diff --git a/docs/Keybindings.md b/docs/Keybindings.md
index 2a1b1817f..37fb523a2 100644
--- a/docs/Keybindings.md
+++ b/docs/Keybindings.md
@@ -44,6 +44,7 @@
<kbd>c</kbd>: checkout by name
<kbd>n</kbd>: new branch
<kbd>d</kbd>: delete branch
+ <kbd>D</kbd>: force delete branch
</pre>
## Commits Panel:
diff --git a/pkg/app/app.go b/pkg/app/app.go
index 20a97276e..102ab4146 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -5,7 +5,7 @@ import (
"io/ioutil"
"os"
- "github.com/Sirupsen/logrus"
+ "github.com/sirupsen/logrus"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui"
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
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index 9f258d4a6..aa56365e3 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -121,10 +121,7 @@ func LoadUserConfigFromFile(v *viper.Viper) error {
folder = configDirs.QueryFolderContainsFile("config.yml")
}
v.AddConfigPath(folder.Path)
- if err := v.MergeInConfig(); err != nil {
- return err
- }
- return nil
+ return v.MergeInConfig()
}
// InsertToUserConfig adds a key/value pair to the user's config and saves it
@@ -139,10 +136,7 @@ func (c *AppConfig) InsertToUserConfig(key, value string) error {
return err
}
v.Set(key, value)
- if err := v.WriteConfig(); err != nil {
- return err
- }
- return nil
+ return v.WriteConfig()
}
func getDefaultConfig() []byte {
diff --git a/pkg/git/branch_list_builder.go b/pkg/git/branch_list_builder.go
index 869e05c98..37421d5b6 100644
--- a/pkg/git/branch_list_builder.go
+++ b/pkg/git/branch_list_builder.go
@@ -7,7 +7,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/utils"
- "github.com/Sirupsen/logrus"
+ "github.com/sirupsen/logrus"
"gopkg.in/src-d/go-git.v4/plumbing"
)
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 67e0ceb07..df4dcff78 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -62,20 +62,34 @@ func (gui *Gui) handleNewBranch(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
+ return gui.deleteBranch(g, v, false)
+}
+
+func (gui *Gui) handleForceDeleteBranch(g *gocui.Gui, v *gocui.View) error {
+ return gui.deleteBranch(g, v, true)
+}
+
+func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error {
checkedOutBranch := gui.State.Branches[0]
selectedBranch := gui.getSelectedBranch(v)
if checkedOutBranch.Name == selectedBranch.Name {
return gui.createErrorPanel(g, gui.Tr.SLocalize("CantDeleteCheckOutBranch"))
}
+ title := gui.Tr.SLocalize("DeleteBranch")
+ var messageId string
+ if force {
+ messageId = "ForceDeleteBranchMessage"
+ } else {
+ messageId = "DeleteBranchMessage"
+ }
message := gui.Tr.TemplateLocalize(
- "DeleteBranchMessage",
+ messageId,
Teml{
"selectedBranchName": selectedBranch.Name,
},
)
- title := gui.Tr.SLocalize("DeleteBranch")
return gui.createConfirmationPanel(g, v, title, message, func(g *gocui.Gui, v *gocui.View) error {
- if err := gui.GitCommand.DeleteBranch(selectedBranch.Name); err != nil {
+ if err := gui.GitCommand.DeleteBranch(selectedBranch.Name, force); err != nil {
return gui.createErrorPanel(g, err.Error())
}
return gui.refreshSidePanels(g)
@@ -108,6 +122,7 @@ func (gui *Gui) renderBranchesOptions(g *gocui.Gui) error {
"c": gui.Tr.SLocalize("checkoutByName"),
"n": gui.Tr.SLocalize("newBranch"),
"d": gui.Tr.SLocalize("deleteBranch"),
+ "D": gui.Tr.SLocalize("forceDeleteBranch"),
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
})
}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 66777b3a6..3d9c7b617 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -15,7 +15,7 @@ import (
// "strings"
- "github.com/Sirupsen/logrus"
+ "github.com/sirupsen/logrus"
"github.com/golang-collections/collections/stack"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index d09ed64b1..8041d14ff 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -58,6 +58,7 @@ func (gui *Gui) keybindings(g *gocui.Gui) error {
{ViewName: "branches", Key: 'F', Modifier: gocui.ModNone, Handler: gui.handleForceCheckout},
{ViewName: "branches", Key: 'n', Modifier: gocui.ModNone, Handler: gui.handleNewBranch},
{ViewName: "branches", Key: 'd', Modifier: gocui.ModNone, Handler: gui.handleDeleteBranch},
+ {ViewName: "branches", Key: 'D', Modifier: gocui.ModNone, Handler: gui.handleForceDeleteBranch},
{ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: gui.handleMerge},
{ViewName: "commits", Key: 's', Modifier: gocui.ModNone, Handler: gui.handleCommitSquashDown},
{ViewName: "commits", Key: 'r', Modifier: gocui.ModNone, Handler: gui.handleRenameCommit},
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index 60133e662..68e7c82bd 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -132,7 +132,10 @@ func addDutch(i18nObject *i18n.Bundle) error {
Other: "Verwijder branch",
}, &i18n.Message{
ID: "DeleteBranchMessage",
- Other: "Weet je zeker dat je {{.selectedBranchName}} branch wil verwijderen?",
+ Other: "Weet je zeker dat je branch {{.selectedBranchName}} wil verwijderen?",
+ }, &i18n.Message{
+ ID: "ForceDeleteBranchMessage",
+ Other: "Weet je zeker dat je branch {{.selectedBranchName}} geforceerd wil verwijderen?",
}, &i18n.Message{
ID: "CantMergeBranchIntoItself",
Other: "Je kan niet een branch in zichzelf mergen",
@@ -152,6 +155,9 @@ func addDutch(i18nObject *i18n.Bundle) error {
ID: "deleteBranch",
Other: "verwijder branch",
}, &i18n.Message{
+ ID: "forceDeleteBranch",
+ Other: "verwijder branch (forceer)",
+ }, &i18n.Message{
ID: "NoBranchesThisRepo",
Other: "Geen branches voor deze repo",
}, &i18n.Message{
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index c0384136b..38fbac4cb 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -140,7 +140,10 @@ func addEnglish(i18nObject *i18n.Bundle) error {
Other: "Delete Branch",
}, &i18n.Message{
ID: "DeleteBranchMessage",
- Other: "Are you sure you want delete the branch {{.selectedBranchName}} ?",
+ Other: "Are you sure you want to delete the branch {{.selectedBranchName}}?",
+ }, &i18n.Message{
+ ID: "ForceDeleteBranchMessage",
+ Other: "Are you sure you want to force delete the branch {{.selectedBranchName}}?",
}, &i18n.Message{
ID: "CantMergeBranchIntoItself",
Other: "You cannot merge a branch into itself",
@@ -160,6 +163,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
ID: "deleteBranch",
Other: "delete branch",
}, &i18n.Message{
+ ID: "forceDeleteBranch",
+ Other: "delete branch (force)",
+ }, &i18n.Message{
ID: "NoBranchesThisRepo",
Other: "No branches for this repo",
}, &i18n.Message{
diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go
index bb97cc9a0..898a13906 100644
--- a/pkg/i18n/i18n.go
+++ b/pkg/i18n/i18n.go
@@ -1,7 +1,7 @@
package i18n
import (
- "github.com/Sirupsen/logrus"
+ "github.com/sirupsen/logrus"
"github.com/cloudfoundry/jibber_jabber"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go
index 481a40863..5eeddb907 100644
--- a/pkg/i18n/i18n_test.go
+++ b/pkg/i18n/i18n_test.go
@@ -6,7 +6,7 @@ import (
"github.com/nicksnyder/go-i18n/v2/i18n"
- "github.com/Sirupsen/logrus"
+ "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
@@ -57,7 +57,7 @@ func TestLocalizer(t *testing.T) {
},
}))
assert.Equal(t, "Diff", l.SLocalize("DiffTitle"))
- assert.Equal(t, "Are you sure you want delete the branch test ?", l.TemplateLocalize("DeleteBranchMessage", Teml{"selectedBranchName": "test"}))
+ assert.Equal(t, "Are you sure you want to delete the branch test?", l.TemplateLocalize("DeleteBranchMessage", Teml{"selectedBranchName": "test"}))
},
},
{
@@ -70,7 +70,7 @@ func TestLocalizer(t *testing.T) {
},
}))
assert.Equal(t, "Diff", l.SLocalize("DiffTitle"))
- assert.Equal(t, "Weet je zeker dat je test branch wil verwijderen?", l.TemplateLocalize("DeleteBranchMessage", Teml{"selectedBranchName": "test"}))
+ assert.Equal(t, "Weet je zeker dat je branch test wil verwijderen?", l.TemplateLocalize("DeleteBranchMessage", Teml{"selectedBranchName": "test"}))
},
},
}
diff --git a/pkg/test/test.go b/pkg/test/test.go
index 7bdbd4c10..6346ac556 100644
--- a/pkg/test/test.go
+++ b/pkg/test/test.go
@@ -4,6 +4,7 @@ import (
"errors"
"os"
"os/exec"
+ "path/filepath"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -11,15 +12,20 @@ import (
// GenerateRepo generates a repo from test/repos and changes the directory to be
// inside the newly made repo
func GenerateRepo(filename string) error {
- testPath := utils.GetProjectRoot() + "/test/repos/"
+ reposDir := "/test/repos/"
+ testPath := utils.GetProjectRoot() + reposDir
+
+ // workaround for debian packaging
+ if _, err := os.Stat(testPath); os.IsNotExist(err) {
+ cwd, _ := os.Getwd()
+ testPath = filepath.Dir(filepath.Dir(cwd)) + reposDir
+ }
if err := os.Chdir(testPath); err != nil {
return err
}
if output, err := exec.Command("bash", filename).CombinedOutput(); err != nil {
return errors.New(string(output))
}
- if err := os.Chdir(testPath + "repo"); err != nil {
- return err
- }
- return nil
+
+ return os.Chdir(testPath + "repo")
}
diff --git a/vendor/github.com/Sirupsen/logrus/LICENSE b/vendor/github.com/sirupsen/logrus/LICENSE
index f090cb42f..f090cb42f 100644
--- a/vendor/github.com/Sirupsen/logrus/LICENSE
+++ b/vendor/github.com/sirupsen/logrus/LICENSE
diff --git a/vendor/github.com/Sirupsen/logrus/alt_exit.go b/vendor/github.com/sirupsen/logrus/alt_exit.go
index 8af90637a..8af90637a 100644
--- a/vendor/github.com/Sirupsen/logrus/alt_exit.go
+++ b/vendor/github.com/sirupsen/logrus/alt_exit.go
diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/sirupsen/logrus/doc.go
index da67aba06..da67aba06 100644
--- a/vendor/github.com/Sirupsen/logrus/doc.go
+++ b/vendor/github.com/sirupsen/logrus/doc.go
diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go
index 473bd1a0d..473bd1a0d 100644
--- a/vendor/github.com/Sirupsen/logrus/entry.go
+++ b/vendor/github.com/sirupsen/logrus/entry.go
diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go
index eb612a6f3..eb612a6f3 100644
--- a/vendor/github.com/Sirupsen/logrus/exported.go
+++ b/vendor/github.com/sirupsen/logrus/exported.go
diff --git a/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/sirupsen/logrus/formatter.go
index 83c74947b..83c74947b 100644
--- a/vendor/github.com/Sirupsen/logrus/formatter.go
+++ b/vendor/github.com/sirupsen/logrus/formatter.go
diff --git a/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/sirupsen/logrus/hooks.go
index 3f151cdc3..3f151cdc3 100644
--- a/vendor/github.com/Sirupsen/logrus/hooks.go
+++ b/vendor/github.com/sirupsen/logrus/hooks.go
diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/sirupsen/logrus/json_formatter.go
index dab17610f..dab17610f 100644
--- a/vendor/github.com/Sirupsen/logrus/json_formatter.go
+++ b/vendor/github.com/sirupsen/logrus/json_formatter.go
diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go
index 342f7977d..342f7977d 100644
--- a/vendor/github.com/Sirupsen/logrus/logger.go
+++ b/vendor/github.com/sirupsen/logrus/logger.go
diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go
index dd3899974..dd3899974 100644
--- a/vendor/github.com/Sirupsen/logrus/logrus.go
+++ b/vendor/github.com/sirupsen/logrus/logrus.go
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/vendor/github.com/sirupsen/logrus/terminal_bsd.go
index 4880d13d2..4880d13d2 100644
--- a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
+++ b/vendor/github.com/sirupsen/logrus/terminal_bsd.go
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
index 3de08e802..3de08e802 100644
--- a/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go
+++ b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
index 067047a12..067047a12 100644
--- a/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go
+++ b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/sirupsen/logrus/terminal_linux.go
index f29a0097c..f29a0097c 100644
--- a/vendor/github.com/Sirupsen/logrus/terminal_linux.go
+++ b/vendor/github.com/sirupsen/logrus/terminal_linux.go
diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go
index 3e5504030..3e5504030 100644
--- a/vendor/github.com/Sirupsen/logrus/text_formatter.go
+++ b/vendor/github.com/sirupsen/logrus/text_formatter.go
diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
index 7bdebedc6..7bdebedc6 100644
--- a/vendor/github.com/Sirupsen/logrus/writer.go
+++ b/vendor/github.com/sirupsen/logrus/writer.go