mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
add GIT_OPTIONAL_LOCKS=0 env var to all commands
This commit is contained in:
parent
0f0fda1660
commit
3e40369fd2
@ -5,14 +5,12 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
|
|
||||||
"github.com/jesseduffield/pty"
|
"github.com/jesseduffield/pty"
|
||||||
"github.com/mgutz/str"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RunCommandWithOutputLiveWrapper runs a command and return every word that gets written in stdout
|
// RunCommandWithOutputLiveWrapper runs a command and return every word that gets written in stdout
|
||||||
@ -20,10 +18,7 @@ import (
|
|||||||
// As return of output you need to give a string that will be written to stdin
|
// As return of output you need to give a string that will be written to stdin
|
||||||
// NOTE: If the return data is empty it won't written anything to stdin
|
// NOTE: If the return data is empty it won't written anything to stdin
|
||||||
func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error {
|
func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error {
|
||||||
splitCmd := str.ToArgv(command)
|
cmd := c.ExecutableFromString(command)
|
||||||
cmd := c.command(splitCmd[0], splitCmd[1:]...)
|
|
||||||
|
|
||||||
cmd.Env = os.Environ()
|
|
||||||
cmd.Env = append(cmd.Env, "LANG=en_US.UTF-8", "LC_ALL=en_US.UTF-8")
|
cmd.Env = append(cmd.Env, "LANG=en_US.UTF-8", "LC_ALL=en_US.UTF-8")
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
|
@ -622,7 +622,7 @@ func (c *GitCommand) FastForward(branchName string) error {
|
|||||||
func (c *GitCommand) RunSkipEditorCommand(command string) error {
|
func (c *GitCommand) RunSkipEditorCommand(command string) error {
|
||||||
cmd := c.OSCommand.ExecutableFromString(command)
|
cmd := c.OSCommand.ExecutableFromString(command)
|
||||||
cmd.Env = append(
|
cmd.Env = append(
|
||||||
os.Environ(),
|
cmd.Env,
|
||||||
"LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY",
|
"LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY",
|
||||||
"EDITOR="+c.OSCommand.GetLazygitPath(),
|
"EDITOR="+c.OSCommand.GetLazygitPath(),
|
||||||
)
|
)
|
||||||
|
@ -78,8 +78,9 @@ func (c *OSCommand) RunExecutable(cmd *exec.Cmd) error {
|
|||||||
// ExecutableFromString takes a string like `git status` and returns an executable command for it
|
// ExecutableFromString takes a string like `git status` and returns an executable command for it
|
||||||
func (c *OSCommand) ExecutableFromString(commandStr string) *exec.Cmd {
|
func (c *OSCommand) ExecutableFromString(commandStr string) *exec.Cmd {
|
||||||
splitCmd := str.ToArgv(commandStr)
|
splitCmd := str.ToArgv(commandStr)
|
||||||
c.Log.Info(splitCmd)
|
cmd := c.command(splitCmd[0], splitCmd[1:]...)
|
||||||
return c.command(splitCmd[0], splitCmd[1:]...)
|
cmd.Env = append(os.Environ(), "GIT_OPTIONAL_LOCKS=0")
|
||||||
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunCommandWithOutputLive runs RunCommandWithOutputLiveWrapper
|
// RunCommandWithOutputLive runs RunCommandWithOutputLiveWrapper
|
||||||
@ -201,8 +202,13 @@ func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
|
// PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
|
||||||
|
// TODO: see if this needs to exist, given that ExecutableFromString does the same things
|
||||||
func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd {
|
func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd {
|
||||||
return c.command(cmdName, commandArgs...)
|
cmd := c.command(cmdName, commandArgs...)
|
||||||
|
if cmd != nil {
|
||||||
|
cmd.Env = append(os.Environ(), "GIT_OPTIONAL_LOCKS=0")
|
||||||
|
}
|
||||||
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quote wraps a message in platform-specific quotation marks
|
// Quote wraps a message in platform-specific quotation marks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user