1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Test bare repos with dotfile setup

This commit is contained in:
Jesse Duffield
2023-08-07 21:28:21 +10:00
parent ecaf1e9002
commit 0551f29de9
5 changed files with 112 additions and 27 deletions

View File

@ -6,9 +6,11 @@ import (
"os/exec"
"path/filepath"
"github.com/jesseduffield/lazycore/pkg/utils"
lazycoreUtils "github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/samber/lo"
)
const (
@ -30,7 +32,7 @@ func RunTests(
keyPressDelay int,
maxAttempts int,
) error {
projectRootDir := utils.GetLazyRootDirectory()
projectRootDir := lazycoreUtils.GetLazyRootDirectory()
err := os.Chdir(projectRootDir)
if err != nil {
return err
@ -177,8 +179,17 @@ func getLazygitCommand(test *IntegrationTest, paths Paths, rootDir string, sandb
return nil, err
}
cmdArgs := []string{tempLazygitPath(), "-debug", "--use-config-dir=" + paths.Config(), "--path=" + paths.ActualRepo()}
cmdArgs = append(cmdArgs, test.ExtraCmdArgs()...)
cmdArgs := []string{tempLazygitPath(), "-debug", "--use-config-dir=" + paths.Config()}
if !test.useCustomPath {
cmdArgs = append(cmdArgs, "--path="+paths.ActualRepo())
}
resolvedExtraArgs := lo.Map(test.ExtraCmdArgs(), func(arg string, _ int) string {
return utils.ResolvePlaceholderString(arg, map[string]string{
"actualPath": paths.Actual(),
"actualRepoPath": paths.ActualRepo(),
})
})
cmdArgs = append(cmdArgs, resolvedExtraArgs...)
cmdObj := osCommand.Cmd.New(cmdArgs)