mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Fix tests
Going and fixing up some submodule tests which were broken by bad assumptions with worktree code
This commit is contained in:
@ -126,15 +126,22 @@ func GetCurrentRepoPath() string {
|
||||
return currentPath()
|
||||
}
|
||||
|
||||
// must be a worktree or bare repo
|
||||
// either in a submodule, a worktree, or a bare repo
|
||||
worktreeGitPath, ok := WorktreeGitPath(pwd)
|
||||
if !ok {
|
||||
// fallback
|
||||
return currentPath()
|
||||
}
|
||||
|
||||
// now we just jump up three directories to get the repo name
|
||||
return filepath.Dir(filepath.Dir(filepath.Dir(worktreeGitPath)))
|
||||
// confirm whether the next directory up is the 'worktrees' directory
|
||||
parent := filepath.Dir(worktreeGitPath)
|
||||
if filepath.Base(parent) != "worktrees" {
|
||||
// fallback
|
||||
return currentPath()
|
||||
}
|
||||
|
||||
// now we just jump up two more directories to get the repo name
|
||||
return filepath.Dir(filepath.Dir(parent))
|
||||
}
|
||||
|
||||
func GetCurrentRepoName() string {
|
||||
@ -159,11 +166,8 @@ func linkedWortkreePaths() []string {
|
||||
// ensure the directory exists
|
||||
_, err := os.Stat(worktreePath)
|
||||
if err != nil {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return result
|
||||
}
|
||||
log.Fatalln(err.Error())
|
||||
}
|
||||
|
||||
err = filepath.Walk(worktreePath, func(path string, info fs.FileInfo, err error) error {
|
||||
if info.IsDir() {
|
||||
@ -181,7 +185,7 @@ func linkedWortkreePaths() []string {
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalln(err.Error())
|
||||
return result
|
||||
}
|
||||
|
||||
return result
|
||||
|
@ -330,7 +330,7 @@ func (self *ViewDriver) Focus() *ViewDriver {
|
||||
}
|
||||
windows := []window{
|
||||
{name: "status", viewNames: []string{"status"}},
|
||||
{name: "files", viewNames: []string{"files", "submodules"}},
|
||||
{name: "files", viewNames: []string{"files", "worktrees", "submodules"}},
|
||||
{name: "branches", viewNames: []string{"localBranches", "remotes", "tags"}},
|
||||
{name: "commits", viewNames: []string{"commits", "reflogCommits"}},
|
||||
{name: "stash", viewNames: []string{"stash"}},
|
||||
|
@ -17,7 +17,9 @@ var SwitchTabFromMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Press(keys.Universal.OptionMenuAlt1)
|
||||
|
||||
t.ExpectPopup().Menu().Title(Equals("Keybindings")).
|
||||
Select(Contains("Next tab")).
|
||||
// Looping back around to the end to side-step the worktrees view which is
|
||||
// only present on recent git versions
|
||||
Select(Contains("Previous tab")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Submodules().IsFocused()
|
||||
|
Reference in New Issue
Block a user