/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/gui/pty_test.go
29 строк
939 B
Stefan Haller
Prevent stale index.lock files from diffs rendered through a pty on Windows
04 авг 2026, 07:53
04 авг 2026, 07:53
0a92529
Код
Авторство
О чём код?
package gui import ( "testing" "github.com/stretchr/testify/assert" ) func TestWithPtyGitConfig(t *testing.T) { args := []string{"git", "-C", "/repo", "diff", "--color=always"} assert.Equal(t, []string{"git", "-c", "diff.autoRefreshIndex=false", "-C", "/repo", "diff", "--color=always"}, withPtyGitConfig(args, "windows")) assert.Equal(t, args, withPtyGitConfig(args, "linux")) assert.Equal(t, args, withPtyGitConfig(args, "darwin")) // A user-configured command that wraps git in a shell must not have git // flags injected into it. shellArgs := []string{"sh", "-c", "git log --graph {{branchName}} -- | sed -e s/x/y/"} assert.Equal(t, shellArgs, withPtyGitConfig(shellArgs, "windows")) // The guard recognizes git regardless of case and extension. exeArgs := []string{"GIT.EXE", "diff"} assert.Equal(t, []string{"GIT.EXE", "-c", "diff.autoRefreshIndex=false", "diff"}, withPtyGitConfig(exeArgs, "windows")) }