From e82d2f37a108afbf4abbdcad9ab1da33f927836d Mon Sep 17 00:00:00 2001 From: David Chen Date: Tue, 2 Jun 2020 23:36:34 -0400 Subject: Update example keybinding config for Colemak users --- docs/Config.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 3b3350ec0..c1548e933 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -95,7 +95,7 @@ Default path for the config file: prevScreenMode: '_' undo: 'z' redo: '' - filteringMenu: + filteringMenu: '' diffingMenu: '' copyToClipboard: '' status: @@ -260,14 +260,18 @@ For all possible keybinding options, check [Custom_Keybindings.md](https://githu scrollDownMain-alt1: 'E' scrollUpMain-alt2: '' scrollDownMain-alt2: '' + undo: 'l' + redo: '' + diffingMenu: 'M' + filteringMenu: '' files: ignoreFile: 'I' commits: moveDownCommit: '' moveUpCommit: '' - toggleDiffCommit: 'l' branches: viewGitFlowOptions: 'I' + setUpstream: 'U' ``` ## Custom pull request URLs -- cgit v1.2.3 From e89bf5d06b8a90b0aca702c0b9ef570504183cd1 Mon Sep 17 00:00:00 2001 From: Jasper Mendiola Date: Fri, 10 Jul 2020 16:22:22 +0800 Subject: add oneline-graph --- docs/Config.md | 1 + pkg/commands/git.go | 6 +++++- pkg/config/app_config.go | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/Config.md b/docs/Config.md index c1548e933..78f504e2c 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -43,6 +43,7 @@ Default path for the config file: args: "" skipHookPrefix: WIP autoFetch: true + branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --" update: method: prompt # can be: prompt | background | never days: 14 # how often an update is checked for diff --git a/pkg/commands/git.go b/pkg/commands/git.go index f7e004108..e6a655782 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -635,7 +635,11 @@ func (c *GitCommand) ShowCmdStr(sha string, filterPath string) string { } func (c *GitCommand) GetBranchGraphCmdStr(branchName string) string { - return fmt.Sprintf("git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium %s --", branchName) + branchLogCmdTemplate := c.Config.GetUserConfig().GetString("git.branchLogCmd") + templateValues := map[string]string{ + "branchName": branchName, + } + return utils.ResolvePlaceholderString(branchLogCmdTemplate, templateValues) } // GetRemoteURL returns current repo remote url diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 9938113d7..23fcb7376 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -270,6 +270,7 @@ git: args: "" skipHookPrefix: 'WIP' autoFetch: true + branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --" update: method: prompt # can be: prompt | background | never days: 14 # how often a update is checked for -- cgit v1.2.3 From cb0bdd89c0b81cd91e9f1869af82f5b7151c2b58 Mon Sep 17 00:00:00 2001 From: Jasper Mendiola Date: Fri, 10 Jul 2020 16:42:55 +0800 Subject: fix tests --- pkg/commands/dummies.go | 8 +++++++- pkg/commands/git_test.go | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pkg/commands/dummies.go b/pkg/commands/dummies.go index 34bf549d3..166fa4c8c 100644 --- a/pkg/commands/dummies.go +++ b/pkg/commands/dummies.go @@ -7,6 +7,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/sirupsen/logrus" "github.com/spf13/viper" + appconfig "github.com/jesseduffield/lazygit/pkg/config" yaml "gopkg.in/yaml.v2" ) @@ -19,6 +20,11 @@ func NewDummyOSCommand() *OSCommand { // NewDummyAppConfig creates a new dummy AppConfig for testing func NewDummyAppConfig() *config.AppConfig { + userConfig := viper.New() + userConfig.SetConfigType("yaml") + if err := appconfig.LoadDefaults(userConfig, appconfig.GetDefaultConfig()); err != nil { + panic(err) + } appConfig := &config.AppConfig{ Name: "lazygit", Version: "unversioned", @@ -26,7 +32,7 @@ func NewDummyAppConfig() *config.AppConfig { BuildDate: "", Debug: false, BuildSource: "", - UserConfig: viper.New(), + UserConfig: userConfig, } _ = yaml.Unmarshal([]byte{}, appConfig.AppState) return appConfig diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index b70947534..8d56dee40 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1384,13 +1384,14 @@ func TestGitCommandCheckout(t *testing.T) { // TestGitCommandGetBranchGraph is a function. func TestGitCommandGetBranchGraph(t *testing.T) { gitCmd := NewDummyGitCommand() + gitCmd.getLocalGitConfig = func(string) (string, error) { + return "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --", nil + } gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) assert.EqualValues(t, []string{"log", "--graph", "--color=always", "--abbrev-commit", "--decorate", "--date=relative", "--pretty=medium", "test", "--"}, args) - return exec.Command("echo") } - _, err := gitCmd.GetBranchGraph("test") assert.NoError(t, err) } @@ -1410,7 +1411,7 @@ func TestGitCommandDiff(t *testing.T) { "Default case", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--color=", "--", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=always", "--", "test.txt"}, args) return exec.Command("echo") }, @@ -1426,7 +1427,7 @@ func TestGitCommandDiff(t *testing.T) { "cached", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--color=", "--cached", "--", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=always", "--cached", "--", "test.txt"}, args) return exec.Command("echo") }, @@ -1458,7 +1459,7 @@ func TestGitCommandDiff(t *testing.T) { "File not tracked and file has no staged changes", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--color=", "--no-index", "/dev/null", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=always", "--no-index", "/dev/null", "test.txt"}, args) return exec.Command("echo") }, -- cgit v1.2.3 From 0f5a073d57d9efdf3e516f5dab913c2eed3fc8b3 Mon Sep 17 00:00:00 2001 From: Jasper Mendiola Date: Fri, 10 Jul 2020 16:46:42 +0800 Subject: Rename appconfig to config --- pkg/commands/dummies.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/commands/dummies.go b/pkg/commands/dummies.go index 166fa4c8c..57bf1bed9 100644 --- a/pkg/commands/dummies.go +++ b/pkg/commands/dummies.go @@ -7,7 +7,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/sirupsen/logrus" "github.com/spf13/viper" - appconfig "github.com/jesseduffield/lazygit/pkg/config" yaml "gopkg.in/yaml.v2" ) @@ -22,7 +21,7 @@ func NewDummyOSCommand() *OSCommand { func NewDummyAppConfig() *config.AppConfig { userConfig := viper.New() userConfig.SetConfigType("yaml") - if err := appconfig.LoadDefaults(userConfig, appconfig.GetDefaultConfig()); err != nil { + if err := config.LoadDefaults(userConfig, config.GetDefaultConfig()); err != nil { panic(err) } appConfig := &config.AppConfig{ -- cgit v1.2.3 From e921ba0910c2431c26ffcbdf3847734e1283dded Mon Sep 17 00:00:00 2001 From: Jasper Mendiola Date: Fri, 10 Jul 2020 16:48:55 +0800 Subject: Remove getLocalGitConfig --- pkg/commands/git_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 8d56dee40..9b34ba364 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1384,9 +1384,6 @@ func TestGitCommandCheckout(t *testing.T) { // TestGitCommandGetBranchGraph is a function. func TestGitCommandGetBranchGraph(t *testing.T) { gitCmd := NewDummyGitCommand() - gitCmd.getLocalGitConfig = func(string) (string, error) { - return "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --", nil - } gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) assert.EqualValues(t, []string{"log", "--graph", "--color=always", "--abbrev-commit", "--decorate", "--date=relative", "--pretty=medium", "test", "--"}, args) -- cgit v1.2.3 From 19a808642f1dee0ee9a19731023f48eff86a1985 Mon Sep 17 00:00:00 2001 From: Randshot Date: Sat, 30 May 2020 23:00:01 +0200 Subject: fix platform specific quoting when using GPG fixes #620 Signed-off-by: Randshot --- pkg/commands/git.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index e6a655782..8fa2c78bd 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -448,7 +448,7 @@ func (c *GitCommand) usingGpg() bool { func (c *GitCommand) Commit(message string, flags string) (*exec.Cmd, error) { command := fmt.Sprintf("git commit %s -m %s", flags, c.OSCommand.Quote(message)) if c.usingGpg() { - return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil + return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)), nil } return nil, c.OSCommand.RunCommand(command) @@ -465,7 +465,7 @@ func (c *GitCommand) GetHeadCommitMessage() (string, error) { func (c *GitCommand) AmendHead() (*exec.Cmd, error) { command := "git commit --amend --no-edit --allow-empty" if c.usingGpg() { - return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil + return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)), nil } return nil, c.OSCommand.RunCommand(command) -- cgit v1.2.3 From d14fb36cb9e6293f87a0071a9ff4509ae23d3e16 Mon Sep 17 00:00:00 2001 From: Randshot Date: Sat, 30 May 2020 23:10:30 +0200 Subject: fix 'Commit using gpg' test Signed-off-by: Randshot --- pkg/commands/git_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 9b34ba364..58210c4a8 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -815,7 +815,7 @@ func TestGitCommandCommit(t *testing.T) { "Commit using gpg", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "bash", cmd) - assert.EqualValues(t, []string{"-c", `git commit -m 'test'`}, args) + assert.EqualValues(t, []string{"-c", "git", "commit", "-m", "test"}, args) return exec.Command("echo") }, -- cgit v1.2.3 From 21e478dd5964f8727302c9d1d6d9e096aa65804a Mon Sep 17 00:00:00 2001 From: Randshot Date: Sat, 30 May 2020 23:30:35 +0200 Subject: fix 'Amend commit using gpg' test Signed-off-by: Randshot --- pkg/commands/git_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 58210c4a8..ed1fed013 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -905,7 +905,7 @@ func TestGitCommandAmendHead(t *testing.T) { "Amend commit using gpg", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "bash", cmd) - assert.EqualValues(t, []string{"-c", "git commit --amend --no-edit --allow-empty"}, args) + assert.EqualValues(t, []string{"-c", "git", "commit", "--amend", "--no-edit", "--allow-empty"}, args) return exec.Command("echo") }, -- cgit v1.2.3 From 7b69aa1fdaa7b1719cee8d9a07df11940c5c6cd0 Mon Sep 17 00:00:00 2001 From: Pranav Shikarpur Date: Sat, 6 Jun 2020 21:31:30 -0400 Subject: Added ENTRYPOINT to Dockerfile to jump directly into lazy git while running the docker container --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 10ed10b2c..aec4ff2a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # run with: # docker build -t lazygit . -# docker run -it lazygit:latest /bin/sh -l +# docker run -it lazygit:latest /bin/sh FROM golang:1.14-alpine3.11 WORKDIR /go/src/github.com/jesseduffield/lazygit/ @@ -13,3 +13,5 @@ WORKDIR /go/src/github.com/jesseduffield/lazygit/ COPY --from=0 /go/src/github.com/jesseduffield/lazygit /go/src/github.com/jesseduffield/lazygit COPY --from=0 /go/src/github.com/jesseduffield/lazygit/lazygit /bin/ RUN echo "alias gg=lazygit" >> ~/.profile + +ENTRYPOINT [ "lazygit" ] -- cgit v1.2.3