diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-27 09:16:41 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-27 19:26:14 +1100 |
commit | d1395b15bb980778b6a77cbc9c3f14775247aa8f (patch) | |
tree | d790646db7e90710b40a8a292918c71d4e213c4a /pkg/commands | |
parent | 2d8ed5e274b39946baa9130d95cfb99641e8ba5d (diff) |
use GIT_EDITOR
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 3 | ||||
-rw-r--r-- | pkg/commands/git_test.go | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 6188de86d..ba20e2316 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -648,6 +648,7 @@ func (c *GitCommand) RunSkipEditorCommand(command string) error { cmd.Env = append( cmd.Env, "LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY", + "GIT_EDITOR="+lazyGitPath, "EDITOR="+lazyGitPath, "VISUAL="+lazyGitPath, ) @@ -758,7 +759,7 @@ func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string ) if overrideEditor { - cmd.Env = append(cmd.Env, "EDITOR="+ex) + cmd.Env = append(cmd.Env, "GIT_EDITOR="+ex) } return cmd, nil diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 2fc9f1ffb..532c07d0a 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -2150,6 +2150,13 @@ func TestGitCommandSkipEditorCommand(t *testing.T) { test.AssertContainsMatch( t, cmd.Env, + regexp.MustCompile("^GIT_EDITOR="), + "expected GIT_EDITOR to be set for a non-interactive external command", + ) + + test.AssertContainsMatch( + t, + cmd.Env, regexp.MustCompile("^LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY$"), "expected LAZYGIT_CLIENT_COMMAND to be set for a non-interactive external command", ) |