From d1395b15bb980778b6a77cbc9c3f14775247aa8f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 27 Mar 2020 09:16:41 +1100 Subject: [PATCH] use GIT_EDITOR --- pkg/commands/git.go | 3 ++- pkg/commands/git_test.go | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 @@ -2147,6 +2147,13 @@ func TestGitCommandSkipEditorCommand(t *testing.T) { "expected EDITOR to be set for a non-interactive external command", ) + 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,