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,