diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go index ecce1834e..a9db34b7e 100644 --- a/pkg/gui/controllers/commits_files_controller.go +++ b/pkg/gui/controllers/commits_files_controller.go @@ -509,7 +509,7 @@ func (self *CommitFilesController) enterCommitFile(node *filetree.CommitFileNode } func (self *CommitFilesController) handleToggleCommitFileDirCollapsed(node *filetree.CommitFileNode) error { - self.context().CommitFileTreeViewModel.ToggleCollapsed(node.GetPath()) + self.context().CommitFileTreeViewModel.ToggleCollapsed(node.GetInternalPath()) self.c.PostRefreshUpdate(self.context()) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index d53eec24b..3c25543dd 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1078,7 +1078,7 @@ func (self *FilesController) handleToggleDirCollapsed() error { return nil } - self.context().FileTreeViewModel.ToggleCollapsed(node.GetPath()) + self.context().FileTreeViewModel.ToggleCollapsed(node.GetInternalPath()) self.c.PostRefreshUpdate(self.c.Contexts().Files) diff --git a/pkg/gui/filetree/build_tree.go b/pkg/gui/filetree/build_tree.go index 1277d7f2e..1168b1a3d 100644 --- a/pkg/gui/filetree/build_tree.go +++ b/pkg/gui/filetree/build_tree.go @@ -14,7 +14,7 @@ func BuildTreeFromFiles(files []*models.File) *Node[models.File] { var curr *Node[models.File] for _, file := range files { - splitPath := split(file.Path) + splitPath := split("./" + file.Path) curr = root outer: for i := range splitPath { @@ -40,6 +40,11 @@ func BuildTreeFromFiles(files []*models.File) *Node[models.File] { continue outer } + if i == 0 && len(files) == 1 && len(splitPath) == 2 { + // skip the root item when there's only one file at top level; we don't need it in that case + continue outer + } + newChild := &Node[models.File]{ path: path, File: setFile, @@ -70,7 +75,7 @@ func BuildTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFil var curr *Node[models.CommitFile] for _, file := range files { - splitPath := split(file.Path) + splitPath := split("./" + file.Path) curr = root outer: for i := range splitPath { @@ -89,6 +94,11 @@ func BuildTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFil } } + if i == 0 && len(files) == 1 && len(splitPath) == 2 { + // skip the root item when there's only one file at top level; we don't need it in that case + continue outer + } + newChild := &Node[models.CommitFile]{ path: path, File: setFile, diff --git a/pkg/gui/filetree/build_tree_test.go b/pkg/gui/filetree/build_tree_test.go index 53d8c9f1a..ca69a33cc 100644 --- a/pkg/gui/filetree/build_tree_test.go +++ b/pkg/gui/filetree/build_tree_test.go @@ -35,15 +35,16 @@ func TestBuildTreeFromFiles(t *testing.T) { path: "", Children: []*Node[models.File]{ { - path: "dir1", + path: "./dir1", + CompressionLevel: 1, Children: []*Node[models.File]{ { File: &models.File{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", }, { File: &models.File{Path: "dir1/b"}, - path: "dir1/b", + path: "./dir1/b", }, }, }, @@ -64,24 +65,29 @@ func TestBuildTreeFromFiles(t *testing.T) { path: "", Children: []*Node[models.File]{ { - path: "dir1/dir3", + path: ".", Children: []*Node[models.File]{ { - File: &models.File{Path: "dir1/dir3/a"}, - path: "dir1/dir3/a", + path: "./dir1/dir3", + Children: []*Node[models.File]{ + { + File: &models.File{Path: "dir1/dir3/a"}, + path: "./dir1/dir3/a", + }, + }, + CompressionLevel: 1, }, - }, - CompressionLevel: 1, - }, - { - path: "dir2/dir4", - Children: []*Node[models.File]{ { - File: &models.File{Path: "dir2/dir4/b"}, - path: "dir2/dir4/b", + path: "./dir2/dir4", + Children: []*Node[models.File]{ + { + File: &models.File{Path: "dir2/dir4/b"}, + path: "./dir2/dir4/b", + }, + }, + CompressionLevel: 1, }, }, - CompressionLevel: 1, }, }, }, @@ -100,12 +106,17 @@ func TestBuildTreeFromFiles(t *testing.T) { path: "", Children: []*Node[models.File]{ { - File: &models.File{Path: "a"}, - path: "a", - }, - { - File: &models.File{Path: "b"}, - path: "b", + path: ".", + Children: []*Node[models.File]{ + { + File: &models.File{Path: "a"}, + path: "./a", + }, + { + File: &models.File{Path: "b"}, + path: "./b", + }, + }, }, }, }, @@ -126,20 +137,25 @@ func TestBuildTreeFromFiles(t *testing.T) { }, expected: &Node[models.File]{ path: "", - // it is a little strange that we're not bubbling up our merge conflict - // here but we are technically still in tree mode and that's the rule Children: []*Node[models.File]{ { - File: &models.File{Path: "a"}, - path: "a", - }, - { - File: &models.File{Path: "b"}, - path: "b", - }, - { - File: &models.File{Path: "z", HasMergeConflicts: true}, - path: "z", + path: ".", + // it is a little strange that we're not bubbling up our merge conflict + // here but we are technically still in tree mode and that's the rule + Children: []*Node[models.File]{ + { + File: &models.File{Path: "a"}, + path: "./a", + }, + { + File: &models.File{Path: "b"}, + path: "./b", + }, + { + File: &models.File{Path: "z", HasMergeConflicts: true}, + path: "./z", + }, + }, }, }, }, @@ -183,12 +199,12 @@ func TestBuildFlatTreeFromFiles(t *testing.T) { Children: []*Node[models.File]{ { File: &models.File{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", CompressionLevel: 0, }, { File: &models.File{Path: "dir1/b"}, - path: "dir1/b", + path: "./dir1/b", CompressionLevel: 0, }, }, @@ -209,12 +225,12 @@ func TestBuildFlatTreeFromFiles(t *testing.T) { Children: []*Node[models.File]{ { File: &models.File{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", CompressionLevel: 0, }, { File: &models.File{Path: "dir2/b"}, - path: "dir2/b", + path: "./dir2/b", CompressionLevel: 0, }, }, @@ -235,11 +251,11 @@ func TestBuildFlatTreeFromFiles(t *testing.T) { Children: []*Node[models.File]{ { File: &models.File{Path: "a"}, - path: "a", + path: "./a", }, { File: &models.File{Path: "b"}, - path: "b", + path: "./b", }, }, }, @@ -277,27 +293,27 @@ func TestBuildFlatTreeFromFiles(t *testing.T) { Children: []*Node[models.File]{ { File: &models.File{Path: "c1", HasMergeConflicts: true}, - path: "c1", + path: "./c1", }, { File: &models.File{Path: "c2", HasMergeConflicts: true}, - path: "c2", + path: "./c2", }, { File: &models.File{Path: "b1", Tracked: true}, - path: "b1", + path: "./b1", }, { File: &models.File{Path: "b2", Tracked: true}, - path: "b2", + path: "./b2", }, { File: &models.File{Path: "a1", Tracked: false}, - path: "a1", + path: "./a1", }, { File: &models.File{Path: "a2", Tracked: false}, - path: "a2", + path: "./a2", }, }, }, @@ -340,15 +356,16 @@ func TestBuildTreeFromCommitFiles(t *testing.T) { path: "", Children: []*Node[models.CommitFile]{ { - path: "dir1", + path: "./dir1", + CompressionLevel: 1, Children: []*Node[models.CommitFile]{ { File: &models.CommitFile{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", }, { File: &models.CommitFile{Path: "dir1/b"}, - path: "dir1/b", + path: "./dir1/b", }, }, }, @@ -369,24 +386,29 @@ func TestBuildTreeFromCommitFiles(t *testing.T) { path: "", Children: []*Node[models.CommitFile]{ { - path: "dir1/dir3", + path: ".", Children: []*Node[models.CommitFile]{ { - File: &models.CommitFile{Path: "dir1/dir3/a"}, - path: "dir1/dir3/a", + path: "./dir1/dir3", + Children: []*Node[models.CommitFile]{ + { + File: &models.CommitFile{Path: "dir1/dir3/a"}, + path: "./dir1/dir3/a", + }, + }, + CompressionLevel: 1, }, - }, - CompressionLevel: 1, - }, - { - path: "dir2/dir4", - Children: []*Node[models.CommitFile]{ { - File: &models.CommitFile{Path: "dir2/dir4/b"}, - path: "dir2/dir4/b", + path: "./dir2/dir4", + Children: []*Node[models.CommitFile]{ + { + File: &models.CommitFile{Path: "dir2/dir4/b"}, + path: "./dir2/dir4/b", + }, + }, + CompressionLevel: 1, }, }, - CompressionLevel: 1, }, }, }, @@ -405,12 +427,17 @@ func TestBuildTreeFromCommitFiles(t *testing.T) { path: "", Children: []*Node[models.CommitFile]{ { - File: &models.CommitFile{Path: "a"}, - path: "a", - }, - { - File: &models.CommitFile{Path: "b"}, - path: "b", + path: ".", + Children: []*Node[models.CommitFile]{ + { + File: &models.CommitFile{Path: "a"}, + path: "./a", + }, + { + File: &models.CommitFile{Path: "b"}, + path: "./b", + }, + }, }, }, }, @@ -454,12 +481,12 @@ func TestBuildFlatTreeFromCommitFiles(t *testing.T) { Children: []*Node[models.CommitFile]{ { File: &models.CommitFile{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", CompressionLevel: 0, }, { File: &models.CommitFile{Path: "dir1/b"}, - path: "dir1/b", + path: "./dir1/b", CompressionLevel: 0, }, }, @@ -480,12 +507,12 @@ func TestBuildFlatTreeFromCommitFiles(t *testing.T) { Children: []*Node[models.CommitFile]{ { File: &models.CommitFile{Path: "dir1/a"}, - path: "dir1/a", + path: "./dir1/a", CompressionLevel: 0, }, { File: &models.CommitFile{Path: "dir2/b"}, - path: "dir2/b", + path: "./dir2/b", CompressionLevel: 0, }, }, @@ -506,11 +533,11 @@ func TestBuildFlatTreeFromCommitFiles(t *testing.T) { Children: []*Node[models.CommitFile]{ { File: &models.CommitFile{Path: "a"}, - path: "a", + path: "./a", }, { File: &models.CommitFile{Path: "b"}, - path: "b", + path: "./b", }, }, }, diff --git a/pkg/gui/filetree/node.go b/pkg/gui/filetree/node.go index c43c23fb4..d46025a0a 100644 --- a/pkg/gui/filetree/node.go +++ b/pkg/gui/filetree/node.go @@ -20,7 +20,7 @@ type Node[T any] struct { Children []*Node[T] // path of the file/directory - // private; use GetPath() to access + // private; use either GetPath() or GetInternalPath() to access path string // rather than render a tree as: @@ -47,7 +47,19 @@ func (self *Node[T]) GetFile() *T { return self.File } +// This returns the logical path from the user's point of view. It is the +// relative path from the root of the repository. +// Use this for display, or when you want to perform some action on the path +// (e.g. a git command). func (self *Node[T]) GetPath() string { + return strings.TrimPrefix(self.path, "./") +} + +// This returns the internal path from the tree's point of view. It's the same +// as GetPath(), but prefixed with "./" for the root item. +// Use this when interacting with the tree itself, e.g. when calling +// ToggleCollapsed. +func (self *Node[T]) GetInternalPath() string { return self.path } diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go index 449dfccec..2b1f3fafa 100644 --- a/pkg/gui/presentation/files.go +++ b/pkg/gui/presentation/files.go @@ -91,11 +91,11 @@ func renderAux[T any]( arr := []string{} if !isRoot { - isCollapsed := collapsedPaths.IsCollapsed(node.GetPath()) + isCollapsed := collapsedPaths.IsCollapsed(node.GetInternalPath()) arr = append(arr, renderLine(node, treeDepth, visualDepth, isCollapsed)) } - if collapsedPaths.IsCollapsed(node.GetPath()) { + if collapsedPaths.IsCollapsed(node.GetInternalPath()) { return arr } @@ -293,7 +293,13 @@ func getColorForChangeStatus(changeStatus string) style.TextStyle { } func fileNameAtDepth(node *filetree.Node[models.File], depth int) string { - splitName := split(node.GetPath()) + splitName := split(node.GetInternalPath()) + if depth == 0 && splitName[0] == "." { + if len(splitName) == 1 { + return "/" + } + depth = 1 + } name := join(splitName[depth:]) if node.File != nil && node.File.IsRename() { @@ -314,7 +320,13 @@ func fileNameAtDepth(node *filetree.Node[models.File], depth int) string { } func commitFileNameAtDepth(node *filetree.Node[models.CommitFile], depth int) string { - splitName := split(node.GetPath()) + splitName := split(node.GetInternalPath()) + if depth == 0 && splitName[0] == "." { + if len(splitName) == 1 { + return "/" + } + depth = 1 + } name := join(splitName[depth:]) return name diff --git a/pkg/gui/presentation/files_test.go b/pkg/gui/presentation/files_test.go index 5427d0c07..858b836d8 100644 --- a/pkg/gui/presentation/files_test.go +++ b/pkg/gui/presentation/files_test.go @@ -48,10 +48,11 @@ func TestRenderFileTree(t *testing.T) { }, showLineChanges: true, expected: []string{ - " M test +1 -1", - " M test2 +1", - " M test3 -1", - " M test4", + "▼ /", + " M test +1 -1", + " M test2 +1", + " M test3 -1", + " M test4", }, }, { @@ -66,16 +67,17 @@ func TestRenderFileTree(t *testing.T) { }, expected: toStringSlice( ` -▶ dir1 -▼ dir2 +▼ / + ▶ dir1 ▼ dir2 - M file3 - M file4 - M file5 -M file1 + ▼ dir2 + M file3 + M file4 + M file5 + M file1 `, ), - collapsedPaths: []string{"dir1"}, + collapsedPaths: []string{"./dir1"}, }, } @@ -127,16 +129,17 @@ func TestRenderCommitFileTree(t *testing.T) { }, expected: toStringSlice( ` -▶ dir1 -▼ dir2 +▼ / + ▶ dir1 ▼ dir2 - D file3 - M file4 - M file5 -M file1 + ▼ dir2 + D file3 + M file4 + M file5 + M file1 `, ), - collapsedPaths: []string{"dir1"}, + collapsedPaths: []string{"./dir1"}, }, } diff --git a/pkg/integration/tests/branch/reset_to_upstream.go b/pkg/integration/tests/branch/reset_to_upstream.go index 6a3bd904a..18f04257e 100644 --- a/pkg/integration/tests/branch/reset_to_upstream.go +++ b/pkg/integration/tests/branch/reset_to_upstream.go @@ -72,8 +72,9 @@ var ResetToUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Contains("hard commit"), ) t.Views().Files().Lines( - Equals("A file-1"), - Equals("A file-2"), + Equals("▼ /"), + Equals(" A file-1"), + Equals(" A file-2"), ) // hard reset diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index 6eeae03ae..c9599f4e0 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -21,19 +21,23 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("?? myfile").IsSelected(), - Equals("?? myfile2"), + Equals("▼ /").IsSelected(), + Equals(" ?? myfile"), + Equals(" ?? myfile2"), ). + SelectNextItem(). PressPrimaryAction(). // stage file Lines( - Equals("A myfile").IsSelected(), - Equals("?? myfile2"), + Equals("▼ /"), + Equals(" A myfile").IsSelected(), + Equals(" ?? myfile2"), ). SelectNextItem(). PressPrimaryAction(). // stage other file Lines( - Equals("A myfile"), - Equals("A myfile2").IsSelected(), + Equals("▼ /"), + Equals(" A myfile"), + Equals(" A myfile2").IsSelected(), ). Press(keys.Files.CommitChanges) @@ -54,8 +58,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A myfile"), - Equals("A myfile2"), + Equals("▼ /"), + Equals(" A myfile"), + Equals(" A myfile2"), ) }, }) diff --git a/pkg/integration/tests/commit/commit_switch_to_editor.go b/pkg/integration/tests/commit/commit_switch_to_editor.go index 069384ab1..b3c82aadc 100644 --- a/pkg/integration/tests/commit/commit_switch_to_editor.go +++ b/pkg/integration/tests/commit/commit_switch_to_editor.go @@ -25,6 +25,12 @@ var CommitSwitchToEditor = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). + Lines( + Equals("▼ /").IsSelected(), + Equals(" ?? file1"), + Equals(" ?? file2"), + ). + SelectNextItem(). PressPrimaryAction(). // stage one of the files Press(keys.Files.CommitChanges) @@ -45,6 +51,9 @@ var CommitSwitchToEditor = NewIntegrationTest(NewIntegrationTestArgs{ // Now check that the preserved commit message was cleared: t.Views().Files(). Focus(). + Lines( + Equals("?? file2"), + ). PressPrimaryAction(). // stage the other file Press(keys.Files.CommitChanges) diff --git a/pkg/integration/tests/commit/discard_old_file_changes.go b/pkg/integration/tests/commit/discard_old_file_changes.go index 8082d0b67..3e4057af5 100644 --- a/pkg/integration/tests/commit/discard_old_file_changes.go +++ b/pkg/integration/tests/commit/discard_old_file_changes.go @@ -43,13 +43,14 @@ var DiscardOldFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" ▼ subd1"), - Equals(" A subfile0"), - Equals(" A d1_file0"), - Equals("▼ dir2"), - Equals(" A d2_file1"), - Equals(" A d2_file2"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir1"), + Equals(" ▼ subd1"), + Equals(" A subfile0"), + Equals(" A d1_file0"), + Equals(" ▼ dir2"), + Equals(" A d2_file1"), + Equals(" A d2_file2"), ). NavigateToLine(Contains("d1_file0")). Press(keys.Universal.Remove) @@ -62,11 +63,12 @@ var DiscardOldFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir1/subd1"), - Equals(" A subfile0"), - Equals("▼ dir2"), - Equals(" A d2_file1").IsSelected(), - Equals(" A d2_file2"), + Equals("▼ /"), + Equals(" ▼ dir1/subd1"), + Equals(" A subfile0"), + Equals(" ▼ dir2"), + Equals(" A d2_file1").IsSelected(), + Equals(" A d2_file2"), ). PressEscape() diff --git a/pkg/integration/tests/commit/reword.go b/pkg/integration/tests/commit/reword.go index 21727c494..c349a0e28 100644 --- a/pkg/integration/tests/commit/reword.go +++ b/pkg/integration/tests/commit/reword.go @@ -20,6 +20,12 @@ var Reword = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). + Lines( + Equals("▼ /").IsSelected(), + Contains("myfile"), + Contains("myfile2"), + ). + SelectNextItem(). PressPrimaryAction(). Press(keys.Files.CommitChanges) diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index 36d9cec58..aac40313b 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -21,7 +21,12 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). - SelectedLine(Contains("myfile")). + Lines( + Equals("▼ /").IsSelected(), + Contains("myfile"), + Contains("myfile2"), + ). + SelectNextItem(). PressPrimaryAction(). // stage the file PressEnter() diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go index fcf53dd22..0a020e58f 100644 --- a/pkg/integration/tests/commit/staged_without_hooks.go +++ b/pkg/integration/tests/commit/staged_without_hooks.go @@ -22,7 +22,12 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ // stage the file t.Views().Files(). IsFocused(). - SelectedLine(Contains("myfile")). + Lines( + Equals("▼ /").IsSelected(), + Contains("myfile"), + Contains("myfile2"), + ). + SelectNextItem(). PressPrimaryAction(). PressEnter() diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index 2cbd5e33c..043e6ea9c 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -21,7 +21,12 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). - SelectedLine(Contains("myfile")). + Lines( + Equals("▼ /").IsSelected(), + Contains("myfile"), + Contains("myfile2"), + ). + SelectNextItem(). PressEnter() t.Views().Staging(). diff --git a/pkg/integration/tests/conflicts/filter.go b/pkg/integration/tests/conflicts/filter.go index f023cd9a6..7b26df6b8 100644 --- a/pkg/integration/tests/conflicts/filter.go +++ b/pkg/integration/tests/conflicts/filter.go @@ -18,8 +18,9 @@ var Filter = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("UU file1").IsSelected(), - Equals("UU file2"), + Equals("▼ /").IsSelected(), + Equals(" UU file1"), + Equals(" UU file2"), ). Press(keys.Files.OpenStatusFilter). Tap(func() { @@ -29,10 +30,11 @@ var Filter = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("UU file1").IsSelected(), - Equals("UU file2"), + Equals("▼ /").IsSelected(), + Equals(" UU file1"), + Equals(" UU file2"), // now we see the non-merge conflict file - Equals("A file3"), + Equals(" A file3"), ) }, }) diff --git a/pkg/integration/tests/conflicts/resolve_multiple_files.go b/pkg/integration/tests/conflicts/resolve_multiple_files.go index 3fdcc9b2c..542a74d54 100644 --- a/pkg/integration/tests/conflicts/resolve_multiple_files.go +++ b/pkg/integration/tests/conflicts/resolve_multiple_files.go @@ -18,9 +18,11 @@ var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("UU file1").IsSelected(), - Equals("UU file2"), + Equals("▼ /").IsSelected(), + Equals(" UU file1"), + Equals(" UU file2"), ). + SelectNextItem(). PressEnter() t.Views().MergeConflicts(). diff --git a/pkg/integration/tests/conflicts/resolve_no_auto_stage.go b/pkg/integration/tests/conflicts/resolve_no_auto_stage.go index 174ef7b32..129ae3fe4 100644 --- a/pkg/integration/tests/conflicts/resolve_no_auto_stage.go +++ b/pkg/integration/tests/conflicts/resolve_no_auto_stage.go @@ -20,9 +20,11 @@ var ResolveNoAutoStage = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("UU file1").IsSelected(), - Equals("UU file2"), + Equals("▼ /").IsSelected(), + Equals(" UU file1"), + Equals(" UU file2"), ). + SelectNextItem(). PressEnter() t.Views().MergeConflicts(). @@ -38,8 +40,9 @@ var ResolveNoAutoStage = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). // Resolving the conflict didn't auto-stage it Lines( - Equals("UU file1").IsSelected(), - Equals("UU file2"), + Equals("▼ /"), + Equals(" UU file1").IsSelected(), + Equals(" UU file2"), ). // So do that manually PressPrimaryAction(). diff --git a/pkg/integration/tests/custom_commands/custom_commands_submenu.go b/pkg/integration/tests/custom_commands/custom_commands_submenu.go index 45e1fb169..a8d13cf73 100644 --- a/pkg/integration/tests/custom_commands/custom_commands_submenu.go +++ b/pkg/integration/tests/custom_commands/custom_commands_submenu.go @@ -68,6 +68,7 @@ var CustomCommandsSubmenu = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( + Equals("▼ /"), Contains("myfile-commits"), Contains("myfile-files"), ) diff --git a/pkg/integration/tests/file/collapse_expand.go b/pkg/integration/tests/file/collapse_expand.go index 713e6bdd0..7ec25b02a 100644 --- a/pkg/integration/tests/file/collapse_expand.go +++ b/pkg/integration/tests/file/collapse_expand.go @@ -21,26 +21,27 @@ var CollapseExpand = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ dir").IsSelected(), - Equals(" ?? file-one"), - Equals("▼ dir2"), - Equals(" ?? file-two"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" ?? file-one"), + Equals(" ▼ dir2"), + Equals(" ?? file-two"), ) t.Views().Files(). Press(keys.Files.CollapseAll). Lines( - Equals("▶ dir"), - Equals("▶ dir2"), + Equals("▶ /"), ) t.Views().Files(). Press(keys.Files.ExpandAll). Lines( - Equals("▼ dir").IsSelected(), - Equals(" ?? file-one"), - Equals("▼ dir2"), - Equals(" ?? file-two"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" ?? file-one"), + Equals(" ▼ dir2"), + Equals(" ?? file-two"), ) }, }) diff --git a/pkg/integration/tests/file/discard_range_select.go b/pkg/integration/tests/file/discard_range_select.go index a4f11c43e..27492cf69 100644 --- a/pkg/integration/tests/file/discard_range_select.go +++ b/pkg/integration/tests/file/discard_range_select.go @@ -29,33 +29,35 @@ var DiscardRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" ?? file-1a"), - Equals(" ?? file-1b"), - Equals("▼ dir2"), - Equals(" ?? file-2a"), - Equals(" M file-2b"), - Equals("▼ dir3"), - Equals(" ?? file-3a"), - Equals(" M file-3b"), - Equals("?? file-a"), - Equals("?? file-b"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir1"), + Equals(" ?? file-1a"), + Equals(" ?? file-1b"), + Equals(" ▼ dir2"), + Equals(" ?? file-2a"), + Equals(" M file-2b"), + Equals(" ▼ dir3"), + Equals(" ?? file-3a"), + Equals(" M file-3b"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), ). NavigateToLine(Contains("file-1b")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-2a")). Lines( - Equals("▼ dir1"), - Equals(" ?? file-1a"), - Equals(" ?? file-1b").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" ?? file-2a").IsSelected(), - Equals(" M file-2b"), - Equals("▼ dir3"), - Equals(" ?? file-3a"), - Equals(" M file-3b"), - Equals("?? file-a"), - Equals("?? file-b"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-1a"), + Equals(" ?? file-1b").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" ?? file-2a").IsSelected(), + Equals(" M file-2b"), + Equals(" ▼ dir3"), + Equals(" ?? file-3a"), + Equals(" M file-3b"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), ). // Discard Press(keys.Universal.Remove). @@ -66,24 +68,26 @@ var DiscardRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("▼ dir1"), - Equals(" ?? file-1a"), - Equals("▼ dir3").IsSelected(), - Equals(" ?? file-3a"), - Equals(" M file-3b"), - Equals("?? file-a"), - Equals("?? file-b"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-1a"), + Equals(" ▼ dir3").IsSelected(), + Equals(" ?? file-3a"), + Equals(" M file-3b"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), ). // Verify you can discard collapsed directories in range select PressEnter(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-a")). Lines( - Equals("▼ dir1"), - Equals(" ?? file-1a"), - Equals("▶ dir3").IsSelected(), - Equals("?? file-a").IsSelected(), - Equals("?? file-b"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-1a"), + Equals(" ▶ dir3").IsSelected(), + Equals(" ?? file-a").IsSelected(), + Equals(" ?? file-b"), ). Press(keys.Universal.Remove). Tap(func() { @@ -93,9 +97,10 @@ var DiscardRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("▼ dir1"), - Equals(" ?? file-1a"), - Equals("?? file-b").IsSelected(), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-1a"), + Equals(" ?? file-b").IsSelected(), ) }, }) diff --git a/pkg/integration/tests/file/discard_staged_changes.go b/pkg/integration/tests/file/discard_staged_changes.go index 475c0ab54..06322567f 100644 --- a/pkg/integration/tests/file/discard_staged_changes.go +++ b/pkg/integration/tests/file/discard_staged_changes.go @@ -24,16 +24,18 @@ var DiscardStagedChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals(" M file2").IsSelected(), - Equals("?? file3"), - Equals(" M fileToRemove"), + Equals("▼ /").IsSelected(), + Equals(" M file2"), + Equals(" ?? file3"), + Equals(" M fileToRemove"), ). NavigateToLine(Contains(`fileToRemove`)). PressPrimaryAction(). Lines( - Equals(" M file2"), - Equals("?? file3"), - Equals("M fileToRemove").IsSelected(), + Equals("▼ /"), + Equals(" M file2"), + Equals(" ?? file3"), + Equals(" M fileToRemove").IsSelected(), ). Press(keys.Files.ViewResetOptions) @@ -42,8 +44,9 @@ var DiscardStagedChanges = NewIntegrationTest(NewIntegrationTestArgs{ // staged file has been removed t.Views().Files(). Lines( - Equals(" M file2"), - Equals("?? file3").IsSelected(), + Equals("▼ /"), + Equals(" M file2"), + Equals(" ?? file3").IsSelected(), ) // the file should have the same content that it originally had, given that that was committed already diff --git a/pkg/integration/tests/file/discard_unstaged_dir_changes.go b/pkg/integration/tests/file/discard_unstaged_dir_changes.go index 0e3d4af98..572194572 100644 --- a/pkg/integration/tests/file/discard_unstaged_dir_changes.go +++ b/pkg/integration/tests/file/discard_unstaged_dir_changes.go @@ -30,13 +30,15 @@ var DiscardUnstagedDirChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ dir").IsSelected(), - Equals(" ▼ subdir"), - Equals(" ?? unstaged-file-one"), - Equals(" MM file-one"), - Equals(" ?? unstaged-file-two"), - Equals("?? unstaged-file-three"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" ▼ subdir"), + Equals(" ?? unstaged-file-one"), + Equals(" MM file-one"), + Equals(" ?? unstaged-file-two"), + Equals(" ?? unstaged-file-three"), ). + SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). @@ -45,10 +47,11 @@ var DiscardUnstagedDirChanges = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("▼ dir").IsSelected(), - Equals(" M file-one"), + Equals("▼ /"), + Equals(" ▼ dir").IsSelected(), + Equals(" M file-one"), // this guy remains untouched because it wasn't inside the 'dir' directory - Equals("?? unstaged-file-three"), + Equals(" ?? unstaged-file-three"), ) t.FileSystem().FileContent("dir/file-one", Equals("original content\nnew content\n")) diff --git a/pkg/integration/tests/file/discard_unstaged_file_changes.go b/pkg/integration/tests/file/discard_unstaged_file_changes.go index aa5ad34f0..f9dcaf6bb 100644 --- a/pkg/integration/tests/file/discard_unstaged_file_changes.go +++ b/pkg/integration/tests/file/discard_unstaged_file_changes.go @@ -26,9 +26,11 @@ var DiscardUnstagedFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("MM file-one").IsSelected(), - Equals("AM file-two"), + Equals("▼ /").IsSelected(), + Equals(" MM file-one"), + Equals(" AM file-two"), ). + SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). @@ -37,13 +39,15 @@ var DiscardUnstagedFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("M file-one").IsSelected(), - Equals("AM file-two"), + Equals("▼ /"), + Equals(" M file-one").IsSelected(), + Equals(" AM file-two"), ). SelectNextItem(). Lines( - Equals("M file-one"), - Equals("AM file-two").IsSelected(), + Equals("▼ /"), + Equals(" M file-one"), + Equals(" AM file-two").IsSelected(), ). Press(keys.Universal.Remove). Tap(func() { @@ -53,8 +57,9 @@ var DiscardUnstagedFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("M file-one"), - Equals("A file-two").IsSelected(), + Equals("▼ /"), + Equals(" M file-one"), + Equals(" A file-two").IsSelected(), ) t.FileSystem().FileContent("file-one", Equals("original content\nnew content\n")) diff --git a/pkg/integration/tests/file/discard_unstaged_range_select.go b/pkg/integration/tests/file/discard_unstaged_range_select.go index ba694fef5..fc99c7502 100644 --- a/pkg/integration/tests/file/discard_unstaged_range_select.go +++ b/pkg/integration/tests/file/discard_unstaged_range_select.go @@ -26,27 +26,29 @@ var DiscardUnstagedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" ?? file-a"), - Equals(" ?? file-b"), - Equals("▼ dir2"), - Equals(" A file-c"), - Equals(" M file-d"), - Equals("?? file-e"), - Equals("?? file-f"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), + Equals(" ▼ dir2"), + Equals(" A file-c"), + Equals(" M file-d"), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). NavigateToLine(Contains("file-b")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-c")). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" ?? file-b").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" A file-c").IsSelected(), - Equals(" M file-d"), - Equals("?? file-e"), - Equals("?? file-f"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" A file-c").IsSelected(), + Equals(" M file-d"), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). // Discard Press(keys.Universal.Remove). @@ -60,14 +62,15 @@ var DiscardUnstagedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ // file-c is still there because it contained no unstaged changes // file-d is gone because it was selected via dir2 and contained only unstaged changes Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals("▼ dir2"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ▼ dir2"), // Re-selecting file-c because it's where the selected line index // was before performing the action. - Equals(" A file-c").IsSelected(), - Equals("?? file-e"), - Equals("?? file-f"), + Equals(" A file-c").IsSelected(), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ) }, }) diff --git a/pkg/integration/tests/file/discard_various_changes.go b/pkg/integration/tests/file/discard_various_changes.go index db96f8db0..0cc188f65 100644 --- a/pkg/integration/tests/file/discard_various_changes.go +++ b/pkg/integration/tests/file/discard_various_changes.go @@ -21,11 +21,17 @@ var DiscardVariousChanges = NewIntegrationTest(NewIntegrationTestArgs{ label string } + t.Views().Files(). + IsFocused(). + TopLines( + Equals("▼ /").IsSelected(), + ) + discardOneByOne := func(files []statusFile) { for _, file := range files { t.Views().Files(). IsFocused(). - SelectedLine(Contains(file.status + " " + file.label)). + NavigateToLine(Contains(file.status + " " + file.label)). Press(keys.Universal.Remove) t.ExpectPopup().Menu(). diff --git a/pkg/integration/tests/file/discard_various_changes_range_select.go b/pkg/integration/tests/file/discard_various_changes_range_select.go index 3620df2e0..403ece7f7 100644 --- a/pkg/integration/tests/file/discard_various_changes_range_select.go +++ b/pkg/integration/tests/file/discard_various_changes_range_select.go @@ -19,14 +19,16 @@ var DiscardVariousChangesRangeSelect = NewIntegrationTest(NewIntegrationTestArgs t.Views().Files(). IsFocused(). Lines( - Equals("UA added-them-changed-us.txt").IsSelected(), - Equals("AA both-added.txt"), - Equals("DD both-deleted.txt"), - Equals("UU both-modded.txt"), - Equals("AU changed-them-added-us.txt"), - Equals("UD deleted-them.txt"), - Equals("DU deleted-us.txt"), + Equals("▼ /").IsSelected(), + Equals(" UA added-them-changed-us.txt"), + Equals(" AA both-added.txt"), + Equals(" DD both-deleted.txt"), + Equals(" UU both-modded.txt"), + Equals(" AU changed-them-added-us.txt"), + Equals(" UD deleted-them.txt"), + Equals(" DU deleted-us.txt"), ). + SelectNextItem(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("deleted-us.txt")). Press(keys.Universal.Remove). @@ -42,17 +44,18 @@ var DiscardVariousChangesRangeSelect = NewIntegrationTest(NewIntegrationTestArgs Cancel() }). Lines( - Equals("AM added-changed.txt").IsSelected(), - Equals("MD change-delete.txt"), - Equals("D delete-change.txt"), - Equals("D deleted-staged.txt"), - Equals(" D deleted.txt"), - Equals("MM double-modded.txt"), - Equals("M modded-staged.txt"), - Equals(" M modded.txt"), - Equals("A new-staged.txt"), - Equals("?? new.txt"), - Equals("R renamed.txt → renamed2.txt"), + Equals("▼ /").IsSelected(), + Equals(" AM added-changed.txt"), + Equals(" MD change-delete.txt"), + Equals(" D delete-change.txt"), + Equals(" D deleted-staged.txt"), + Equals(" D deleted.txt"), + Equals(" MM double-modded.txt"), + Equals(" M modded-staged.txt"), + Equals(" M modded.txt"), + Equals(" A new-staged.txt"), + Equals(" ?? new.txt"), + Equals(" R renamed.txt → renamed2.txt"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("renamed.txt")). diff --git a/pkg/integration/tests/file/gitignore.go b/pkg/integration/tests/file/gitignore.go index d9dfeacfa..0d7c1a019 100644 --- a/pkg/integration/tests/file/gitignore.go +++ b/pkg/integration/tests/file/gitignore.go @@ -20,10 +20,12 @@ var Gitignore = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("?? .gitignore").IsSelected(), - Equals("?? toExclude"), - Equals("?? toIgnore"), + Equals("▼ /").IsSelected(), + Equals(" ?? .gitignore"), + Equals(" ?? toExclude"), + Equals(" ?? toIgnore"), ). + SelectNextItem(). Press(keys.Files.IgnoreFile). // ensure we can't exclude the .gitignore file Tap(func() { diff --git a/pkg/integration/tests/file/remember_commit_message_after_fail.go b/pkg/integration/tests/file/remember_commit_message_after_fail.go index 828b30330..b6938ba55 100644 --- a/pkg/integration/tests/file/remember_commit_message_after_fail.go +++ b/pkg/integration/tests/file/remember_commit_message_after_fail.go @@ -31,6 +31,7 @@ var RememberCommitMessageAfterFail = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( + Equals("▼ /"), Contains("bad"), Contains("one"), ). @@ -40,6 +41,7 @@ var RememberCommitMessageAfterFail = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Git command failed")).Confirm() }). + NavigateToLine(Contains("bad")). Press(keys.Universal.Remove). // remove file that triggers pre-commit hook to fail Tap(func() { t.ExpectPopup().Menu(). diff --git a/pkg/integration/tests/file/rename_similarity_threshold_change.go b/pkg/integration/tests/file/rename_similarity_threshold_change.go index 175a4f3c5..b2a6fc376 100644 --- a/pkg/integration/tests/file/rename_similarity_threshold_change.go +++ b/pkg/integration/tests/file/rename_similarity_threshold_change.go @@ -21,8 +21,9 @@ var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("D original"), - Equals("A renamed"), + Equals("▼ /"), + Equals(" D original"), + Equals(" A renamed"), ). Press(keys.Universal.DecreaseRenameSimilarityThreshold). Tap(func() { diff --git a/pkg/integration/tests/file/stage_children_range_select.go b/pkg/integration/tests/file/stage_children_range_select.go index a79b1ce54..5bcf30336 100644 --- a/pkg/integration/tests/file/stage_children_range_select.go +++ b/pkg/integration/tests/file/stage_children_range_select.go @@ -21,12 +21,13 @@ var StageChildrenRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ baz").IsSelected(), - Equals(" ?? file"), - Equals("▼ bazbam"), - Equals(" ?? file"), - Equals("?? foo"), - Equals("?? foobar"), + Equals("▼ /").IsSelected(), + Equals(" ▼ baz"), + Equals(" ?? file"), + Equals(" ▼ bazbam"), + Equals(" ?? file"), + Equals(" ?? foo"), + Equals(" ?? foobar"), ). // Select everything Press(keys.Universal.ToggleRangeSelect). @@ -34,12 +35,13 @@ var StageChildrenRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ // Stage PressPrimaryAction(). Lines( - Equals("▼ baz").IsSelected(), - Equals(" A file").IsSelected(), - Equals("▼ bazbam").IsSelected(), - Equals(" A file").IsSelected(), - Equals("A foo").IsSelected(), - Equals("A foobar").IsSelected(), + Equals("▼ /").IsSelected(), + Equals(" ▼ baz").IsSelected(), + Equals(" A file").IsSelected(), + Equals(" ▼ bazbam").IsSelected(), + Equals(" A file").IsSelected(), + Equals(" A foo").IsSelected(), + Equals(" A foobar").IsSelected(), ) }, }) diff --git a/pkg/integration/tests/file/stage_deleted_range_select.go b/pkg/integration/tests/file/stage_deleted_range_select.go index aed4dd975..702f1bf6c 100644 --- a/pkg/integration/tests/file/stage_deleted_range_select.go +++ b/pkg/integration/tests/file/stage_deleted_range_select.go @@ -23,28 +23,33 @@ var StageDeletedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals(" D file-a").IsSelected(), - Equals(" D file-b"), + Equals("▼ /").IsSelected(), + Equals(" D file-a"), + Equals(" D file-b"), ). + SelectNextItem(). // Stage a single deleted file PressPrimaryAction(). Lines( - Equals("D file-a").IsSelected(), - Equals(" D file-b"), + Equals("▼ /"), + Equals(" D file-a").IsSelected(), + Equals(" D file-b"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-b")). // Stage both files while a deleted file is already staged PressPrimaryAction(). Lines( - Equals("D file-a").IsSelected(), - Equals("D file-b").IsSelected(), + Equals("▼ /"), + Equals(" D file-a").IsSelected(), + Equals(" D file-b").IsSelected(), ). // Unstage; back to everything being unstaged PressPrimaryAction(). Lines( - Equals(" D file-a").IsSelected(), - Equals(" D file-b").IsSelected(), + Equals("▼ /"), + Equals(" D file-a").IsSelected(), + Equals(" D file-b").IsSelected(), ) }, }) diff --git a/pkg/integration/tests/file/stage_range_select.go b/pkg/integration/tests/file/stage_range_select.go index 3d7a7f233..ea80e3ff6 100644 --- a/pkg/integration/tests/file/stage_range_select.go +++ b/pkg/integration/tests/file/stage_range_select.go @@ -26,14 +26,15 @@ var StageRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" ?? file-a"), - Equals(" ?? file-b"), - Equals("▼ dir2"), - Equals(" ?? file-c"), - Equals(" M file-d"), - Equals("?? file-e"), - Equals("?? file-f"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), + Equals(" ▼ dir2"), + Equals(" ?? file-c"), + Equals(" M file-d"), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). NavigateToLine(Contains("file-b")). Press(keys.Universal.ToggleRangeSelect). @@ -41,27 +42,29 @@ var StageRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ // Stage PressPrimaryAction(). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" A file-b").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" A file-c").IsSelected(), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" A file-b").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" A file-c").IsSelected(), // Staged because dir2 was part of the selection when he hit space - Equals(" M file-d"), - Equals("?? file-e"), - Equals("?? file-f"), + Equals(" M file-d"), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). // Unstage; back to everything being unstaged PressPrimaryAction(). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" ?? file-b").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" ?? file-c").IsSelected(), - Equals(" M file-d"), - Equals("?? file-e"), - Equals("?? file-f"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" ?? file-c").IsSelected(), + Equals(" M file-d"), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). @@ -69,38 +72,41 @@ var StageRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ // Collapse the directory PressEnter(). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" ?? file-b"), - Equals("▶ dir2").IsSelected(), - Equals("?? file-e"), - Equals("?? file-f"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), + Equals(" ▶ dir2").IsSelected(), + Equals(" ?? file-e"), + Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-e")). // Stage PressPrimaryAction(). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" ?? file-b"), - Equals("▶ dir2").IsSelected(), - Equals("A file-e").IsSelected(), - Equals("?? file-f"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), + Equals(" ▶ dir2").IsSelected(), + Equals(" A file-e").IsSelected(), + Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). // Expand the directory again to verify it's been staged PressEnter(). Lines( - Equals("▼ dir1"), - Equals(" ?? file-a"), - Equals(" ?? file-b"), - Equals("▼ dir2").IsSelected(), - Equals(" A file-c"), - Equals(" M file-d"), - Equals("A file-e"), - Equals("?? file-f"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ?? file-a"), + Equals(" ?? file-b"), + Equals(" ▼ dir2").IsSelected(), + Equals(" A file-c"), + Equals(" M file-d"), + Equals(" A file-e"), + Equals(" ?? file-f"), ) }, }) diff --git a/pkg/integration/tests/filter_and_search/filter_by_file_status.go b/pkg/integration/tests/filter_and_search/filter_by_file_status.go index 0c5f95e1d..2e706936f 100644 --- a/pkg/integration/tests/filter_and_search/filter_by_file_status.go +++ b/pkg/integration/tests/filter_and_search/filter_by_file_status.go @@ -29,8 +29,9 @@ var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Focus(). Lines( - Equals("A file-staged-but-untracked").IsSelected(), - Equals(" M file-tracked"), + Equals("▼ /").IsSelected(), + Equals(" A file-staged-but-untracked"), + Equals(" M file-tracked"), ). Press(keys.Files.OpenStatusFilter). Tap(func() { @@ -50,8 +51,9 @@ var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("A file-staged-but-untracked").IsSelected(), - Equals(" M file-tracked"), + Equals("▼ /").IsSelected(), + Equals(" A file-staged-but-untracked"), + Equals(" M file-tracked"), ). Press(keys.Files.OpenStatusFilter). Tap(func() { @@ -61,8 +63,9 @@ var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Equals("A file-staged-but-untracked").IsSelected(), - Equals(" M file-tracked"), + Equals("▼ /").IsSelected(), + Equals(" A file-staged-but-untracked"), + Equals(" M file-tracked"), ) }, }) diff --git a/pkg/integration/tests/filter_and_search/nested_filter.go b/pkg/integration/tests/filter_and_search/nested_filter.go index 6562ea295..db20dd5b5 100644 --- a/pkg/integration/tests/filter_and_search/nested_filter.go +++ b/pkg/integration/tests/filter_and_search/nested_filter.go @@ -61,15 +61,17 @@ var NestedFilter = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A apple").IsSelected(), - Equals("A grape"), - Equals("A orange"), + Equals("▼ /").IsSelected(), + Equals(" A apple"), + Equals(" A grape"), + Equals(" A orange"), ). FilterOrSearch("grape"). Lines( - Equals("A apple"), - Equals("A grape").IsSelected(), - Equals("A orange"), + Equals("▼ /"), + Equals(" A apple"), + Equals(" A grape").IsSelected(), + Equals(" A orange"), ). PressEnter() @@ -87,9 +89,10 @@ var NestedFilter = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A apple"), - Equals("A grape").IsSelected(), - Equals("A orange"), + Equals("▼ /"), + Equals(" A apple"), + Equals(" A grape").IsSelected(), + Equals(" A orange"), ). Tap(func() { t.Views().Search().IsVisible().Content(Contains("matches for 'grape'")) @@ -100,9 +103,10 @@ var NestedFilter = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Search().IsInvisible() }). Lines( - Equals("A apple"), - Equals("A grape").IsSelected(), - Equals("A orange"), + Equals("▼ /"), + Equals(" A apple"), + Equals(" A grape").IsSelected(), + Equals(" A orange"), ). // escape to sub-commits view PressEscape() diff --git a/pkg/integration/tests/filter_and_search/nested_filter_transient.go b/pkg/integration/tests/filter_and_search/nested_filter_transient.go index 84f12fda8..8548d68c0 100644 --- a/pkg/integration/tests/filter_and_search/nested_filter_transient.go +++ b/pkg/integration/tests/filter_and_search/nested_filter_transient.go @@ -69,13 +69,15 @@ var NestedFilterTransient = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A file-one").IsSelected(), - Equals("A file-two"), + Equals("▼ /").IsSelected(), + Equals(" A file-one"), + Equals(" A file-two"), ). FilterOrSearch("two"). Lines( - Equals("A file-one"), - Equals("A file-two").IsSelected(), + Equals("▼ /"), + Equals(" A file-one"), + Equals(" A file-two").IsSelected(), ) t.Views().Branches(). @@ -96,8 +98,9 @@ var NestedFilterTransient = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). // the search on the commit-files context has been cancelled Lines( - Equals("A file-one").IsSelected(), - Equals("A file-two"), + Equals("▼ /").IsSelected(), + Equals(" A file-one"), + Equals(" A file-two"), ). Tap(func() { t.Views().Search().IsInvisible() diff --git a/pkg/integration/tests/filter_by_path/shared.go b/pkg/integration/tests/filter_by_path/shared.go index 646df0d28..6fec20a3e 100644 --- a/pkg/integration/tests/filter_by_path/shared.go +++ b/pkg/integration/tests/filter_by_path/shared.go @@ -40,6 +40,7 @@ func postFilterTest(t *TestDriver) { t.Views().CommitFiles(). IsFocused(). Lines( + Equals("▼ /"), Contains(`filterFile`), Contains(`otherFile`), ) diff --git a/pkg/integration/tests/patch_building/apply_in_reverse.go b/pkg/integration/tests/patch_building/apply_in_reverse.go index d2fadae65..f15d4c35c 100644 --- a/pkg/integration/tests/patch_building/apply_in_reverse.go +++ b/pkg/integration/tests/patch_building/apply_in_reverse.go @@ -26,9 +26,11 @@ var ApplyInReverse = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A file1").IsSelected(), - Equals("A file2"), + Equals("▼ /").IsSelected(), + Equals(" A file1"), + Equals(" A file2"), ). + SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go b/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go index ea90f5ed7..78367cc84 100644 --- a/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go +++ b/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go @@ -34,9 +34,11 @@ var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("M file1").IsSelected(), - Equals("M file2"), + Equals("▼ /").IsSelected(), + Equals(" M file1"), + Equals(" M file2"), ). + SelectNextItem(). // Add both files to the patch; the first will conflict, the second won't PressPrimaryAction(). Tap(func() { @@ -81,9 +83,11 @@ var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Focus(). Lines( - Equals("M file1").IsSelected(), - Equals("M file2"), - ) + Equals("▼ /").IsSelected(), + Equals(" M file1"), + Equals(" M file2"), + ). + SelectNextItem() t.Views().Main(). ContainsLines( diff --git a/pkg/integration/tests/patch_building/move_range_to_index.go b/pkg/integration/tests/patch_building/move_range_to_index.go index e09f72536..fbacb50a5 100644 --- a/pkg/integration/tests/patch_building/move_range_to_index.go +++ b/pkg/integration/tests/patch_building/move_range_to_index.go @@ -31,10 +31,12 @@ var MoveRangeToIndex = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("M file1").IsSelected(), - Equals("A file2"), - Equals("A file3"), + Equals("▼ /").IsSelected(), + Equals(" M file1"), + Equals(" A file2"), + Equals(" A file3"), ). + SelectNextItem(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file2")). PressPrimaryAction() @@ -55,8 +57,9 @@ var MoveRangeToIndex = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Focus(). Lines( - Equals("M file1").IsSelected(), - Equals("A file2"), + Equals("▼ /").IsSelected(), + Equals(" M file1"), + Equals(" A file2"), ) t.Views().Main(). diff --git a/pkg/integration/tests/patch_building/move_to_earlier_commit.go b/pkg/integration/tests/patch_building/move_to_earlier_commit.go index 5d9fd9c7e..c7916c0a6 100644 --- a/pkg/integration/tests/patch_building/move_to_earlier_commit.go +++ b/pkg/integration/tests/patch_building/move_to_earlier_commit.go @@ -66,11 +66,12 @@ var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir").IsSelected(), - Equals(" M file1"), - Equals(" D file2"), - Equals(" A file3"), - Equals("A unrelated-file"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" M file1"), + Equals(" D file2"), + Equals(" A file3"), + Equals(" A unrelated-file"), ). PressEscape() diff --git a/pkg/integration/tests/patch_building/move_to_earlier_commit_no_keep_empty.go b/pkg/integration/tests/patch_building/move_to_earlier_commit_no_keep_empty.go index d7376056b..e3a9003c0 100644 --- a/pkg/integration/tests/patch_building/move_to_earlier_commit_no_keep_empty.go +++ b/pkg/integration/tests/patch_building/move_to_earlier_commit_no_keep_empty.go @@ -66,11 +66,12 @@ var MoveToEarlierCommitNoKeepEmpty = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir").IsSelected(), - Equals(" M file1"), - Equals(" D file2"), - Equals(" A file3"), - Equals("A unrelated-file"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" M file1"), + Equals(" D file2"), + Equals(" A file3"), + Equals(" A unrelated-file"), ). PressEscape() }, diff --git a/pkg/integration/tests/patch_building/move_to_index.go b/pkg/integration/tests/patch_building/move_to_index.go index 5ae6a4d33..af2e867c7 100644 --- a/pkg/integration/tests/patch_building/move_to_index.go +++ b/pkg/integration/tests/patch_building/move_to_index.go @@ -26,9 +26,11 @@ var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("file1").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("file1"), Contains("file2"), ). + SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/patch_building/move_to_later_commit.go b/pkg/integration/tests/patch_building/move_to_later_commit.go index f6c49ea58..aa97a9504 100644 --- a/pkg/integration/tests/patch_building/move_to_later_commit.go +++ b/pkg/integration/tests/patch_building/move_to_later_commit.go @@ -66,11 +66,12 @@ var MoveToLaterCommit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir").IsSelected(), - Equals(" M file1"), - Equals(" D file2"), - Equals(" A file3"), - Equals("A unrelated-file"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir"), + Equals(" M file1"), + Equals(" D file2"), + Equals(" A file3"), + Equals(" A unrelated-file"), ). PressEscape() diff --git a/pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go b/pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go index 9ec9efac7..974dd4ec6 100644 --- a/pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go +++ b/pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go @@ -67,9 +67,11 @@ var MoveToLaterCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("file1").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("file1"), Contains("unrelated-file"), ). + SelectNextItem(). Tap(func() { t.Views().Main(). Content(Contains("+1st line\n 2nd line")) diff --git a/pkg/integration/tests/patch_building/remove_from_commit.go b/pkg/integration/tests/patch_building/remove_from_commit.go index fddbdc839..bfa0925d6 100644 --- a/pkg/integration/tests/patch_building/remove_from_commit.go +++ b/pkg/integration/tests/patch_building/remove_from_commit.go @@ -26,9 +26,11 @@ var RemoveFromCommit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("file1").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("file1"), Contains("file2"), ). + SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/patch_building/select_all_files.go b/pkg/integration/tests/patch_building/select_all_files.go index feef6f291..b4a2f6335 100644 --- a/pkg/integration/tests/patch_building/select_all_files.go +++ b/pkg/integration/tests/patch_building/select_all_files.go @@ -27,9 +27,10 @@ var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("A file1").IsSelected(), - Equals("A file2"), - Equals("A file3"), + Equals("▼ /").IsSelected(), + Equals(" A file1"), + Equals(" A file2"), + Equals(" A file3"), ). Press(keys.Files.ToggleStagedAll) diff --git a/pkg/integration/tests/patch_building/specific_selection.go b/pkg/integration/tests/patch_building/specific_selection.go index b59b62ccb..9027a34e6 100644 --- a/pkg/integration/tests/patch_building/specific_selection.go +++ b/pkg/integration/tests/patch_building/specific_selection.go @@ -33,10 +33,12 @@ var SpecificSelection = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("direct-file").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("direct-file"), Contains("hunk-file"), Contains("line-file"), ). + SelectNextItem(). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/patch_building/toggle_range.go b/pkg/integration/tests/patch_building/toggle_range.go index 878988b84..c6fbd1f49 100644 --- a/pkg/integration/tests/patch_building/toggle_range.go +++ b/pkg/integration/tests/patch_building/toggle_range.go @@ -34,28 +34,30 @@ var ToggleRange = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" A file1-a"), - Equals(" A file2-a"), - Equals(" A file3-a"), - Equals("▼ dir2"), - Equals(" A file1-b"), - Equals(" A file2-b"), - Equals(" A file3-b"), + Equals("▼ /").IsSelected(), + Equals(" ▼ dir1"), + Equals(" A file1-a"), + Equals(" A file2-a"), + Equals(" A file3-a"), + Equals(" ▼ dir2"), + Equals(" A file1-b"), + Equals(" A file2-b"), + Equals(" A file3-b"), ). NavigateToLine(Contains("file1-a")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file3-a")). PressPrimaryAction(). Lines( - Equals("▼ dir1"), - Equals(" ● file1-a").IsSelected(), - Equals(" ● file2-a").IsSelected(), - Equals(" ● file3-a").IsSelected(), - Equals("▼ dir2"), - Equals(" A file1-b"), - Equals(" A file2-b"), - Equals(" A file3-b"), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ● file1-a").IsSelected(), + Equals(" ● file2-a").IsSelected(), + Equals(" ● file3-a").IsSelected(), + Equals(" ▼ dir2"), + Equals(" A file1-b"), + Equals(" A file2-b"), + Equals(" A file3-b"), ). PressEscape(). NavigateToLine(Contains("file3-b")). @@ -69,39 +71,42 @@ var ToggleRange = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("▼ dir1"), - Equals(" ● file1-a"), - Equals(" ● file2-a"), - Equals(" ● file3-a"), - Equals("▼ dir2"), - Equals(" A file1-b"), - Equals(" A file2-b"), - Equals(" ◐ file3-b").IsSelected(), + Equals("▼ /"), + Equals(" ▼ dir1"), + Equals(" ● file1-a"), + Equals(" ● file2-a"), + Equals(" ● file3-a"), + Equals(" ▼ dir2"), + Equals(" A file1-b"), + Equals(" A file2-b"), + Equals(" ◐ file3-b").IsSelected(), ). NavigateToLine(Contains("dir1")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). PressPrimaryAction(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" ● file1-a").IsSelected(), - Equals(" ● file2-a").IsSelected(), - Equals(" ● file3-a").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" ● file1-b"), - Equals(" ● file2-b"), - Equals(" ● file3-b"), + Equals("▼ /"), + Equals(" ▼ dir1").IsSelected(), + Equals(" ● file1-a").IsSelected(), + Equals(" ● file2-a").IsSelected(), + Equals(" ● file3-a").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" ● file1-b"), + Equals(" ● file2-b"), + Equals(" ● file3-b"), ). PressPrimaryAction(). Lines( - Equals("▼ dir1").IsSelected(), - Equals(" A file1-a").IsSelected(), - Equals(" A file2-a").IsSelected(), - Equals(" A file3-a").IsSelected(), - Equals("▼ dir2").IsSelected(), - Equals(" A file1-b"), - Equals(" A file2-b"), - Equals(" A file3-b"), + Equals("▼ /"), + Equals(" ▼ dir1").IsSelected(), + Equals(" A file1-a").IsSelected(), + Equals(" A file2-a").IsSelected(), + Equals(" A file3-a").IsSelected(), + Equals(" ▼ dir2").IsSelected(), + Equals(" A file1-b"), + Equals(" A file2-b"), + Equals(" A file3-b"), ) }, }) diff --git a/pkg/integration/tests/reflog/patch.go b/pkg/integration/tests/reflog/patch.go index 415fb18ee..3db994ba4 100644 --- a/pkg/integration/tests/reflog/patch.go +++ b/pkg/integration/tests/reflog/patch.go @@ -48,9 +48,11 @@ var Patch = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("file1").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("file1"), Contains("file2"), ). + SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/staging/discard_all_changes.go b/pkg/integration/tests/staging/discard_all_changes.go index ae04547c0..e73f69a5e 100644 --- a/pkg/integration/tests/staging/discard_all_changes.go +++ b/pkg/integration/tests/staging/discard_all_changes.go @@ -22,9 +22,11 @@ var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsFocused(). Lines( - Equals(" M file1").IsSelected(), - Equals(" M file2"), + Equals("▼ /").IsSelected(), + Equals(" M file1"), + Equals(" M file2"), ). + SelectNextItem(). PressEnter() t.Views().Staging(). @@ -44,7 +46,7 @@ var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{ // because there are no more changes in file1 we switch to file2 t.Views().Files(). Lines( - Equals(" M file2").IsSelected(), + Equals(" M file2"), ) }). // assert we are still in the staging panel, but now looking at the changes of the other file diff --git a/pkg/integration/tests/stash/apply_patch.go b/pkg/integration/tests/stash/apply_patch.go index ba454178b..7f47beca2 100644 --- a/pkg/integration/tests/stash/apply_patch.go +++ b/pkg/integration/tests/stash/apply_patch.go @@ -30,9 +30,11 @@ var ApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Contains("myfile").IsSelected(), + Equals("▼ /").IsSelected(), + Contains("myfile"), Contains("myfile2"), ). + SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/stash/stash_and_keep_index.go b/pkg/integration/tests/stash/stash_and_keep_index.go index c4b346bb1..9ba036164 100644 --- a/pkg/integration/tests/stash/stash_and_keep_index.go +++ b/pkg/integration/tests/stash/stash_and_keep_index.go @@ -23,8 +23,9 @@ var StashAndKeepIndex = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( - Equals("M file-staged"), - Equals(" M file-unstaged"), + Equals("▼ /"), + Equals(" M file-staged"), + Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) @@ -49,8 +50,9 @@ var StashAndKeepIndex = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().CommitFiles(). IsFocused(). Lines( - Equals("M file-staged"), - Equals("M file-unstaged"), + Equals("▼ /"), + Equals(" M file-staged"), + Equals(" M file-unstaged"), ) }, }) diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go index 1a6be8013..91400d8a2 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -22,8 +22,9 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( - Equals("A file_1"), - Equals("?? file_2"), + Equals("▼ /"), + Equals(" A file_1"), + Equals(" ?? file_2"), ). Press(keys.Files.ViewStashOptions) diff --git a/pkg/integration/tests/stash/stash_staged.go b/pkg/integration/tests/stash/stash_staged.go index 8e11265f7..38d96a354 100644 --- a/pkg/integration/tests/stash/stash_staged.go +++ b/pkg/integration/tests/stash/stash_staged.go @@ -23,8 +23,9 @@ var StashStaged = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( - Equals("M file-staged"), - Equals(" M file-unstaged"), + Equals("▼ /"), + Equals(" M file-staged"), + Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) diff --git a/pkg/integration/tests/stash/stash_unstaged.go b/pkg/integration/tests/stash/stash_unstaged.go index 7d1ca0db3..0604b1cce 100644 --- a/pkg/integration/tests/stash/stash_unstaged.go +++ b/pkg/integration/tests/stash/stash_unstaged.go @@ -23,8 +23,9 @@ var StashUnstaged = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( - Equals("M file-staged"), - Equals(" M file-unstaged"), + Equals("▼ /"), + Equals(" M file-staged"), + Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) diff --git a/pkg/integration/tests/submodule/add.go b/pkg/integration/tests/submodule/add.go index d885ffaa1..a82a71227 100644 --- a/pkg/integration/tests/submodule/add.go +++ b/pkg/integration/tests/submodule/add.go @@ -44,9 +44,11 @@ var Add = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().Focus(). Lines( - Equals("A .gitmodules").IsSelected(), - Equals("A my_submodule_path (submodule)"), + Equals("▼ /").IsSelected(), + Equals(" A .gitmodules"), + Equals(" A my_submodule_path (submodule)"), ). + SelectNextItem(). Tap(func() { t.Views().Main().Content( Contains("[submodule \"my_submodule\"]"). diff --git a/pkg/integration/tests/submodule/remove.go b/pkg/integration/tests/submodule/remove.go index 06176ee95..9290726ff 100644 --- a/pkg/integration/tests/submodule/remove.go +++ b/pkg/integration/tests/submodule/remove.go @@ -35,9 +35,11 @@ var Remove = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().Focus(). Lines( - Equals("M .gitmodules").IsSelected(), - Equals("D my_submodule_path"), - ) + Equals("▼ /").IsSelected(), + Equals(" M .gitmodules"), + Equals(" D my_submodule_path"), + ). + SelectNextItem() t.Views().Main().Content( Contains("-[submodule \"my_submodule_name\"]"). diff --git a/pkg/integration/tests/submodule/remove_nested.go b/pkg/integration/tests/submodule/remove_nested.go index 945361084..fe05c0fb0 100644 --- a/pkg/integration/tests/submodule/remove_nested.go +++ b/pkg/integration/tests/submodule/remove_nested.go @@ -39,9 +39,10 @@ var RemoveNested = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().IsFocused(). Lines( - Equals("▼ modules").IsSelected(), - Equals(" D innerSubPath"), - Equals("M .gitmodules"), + Equals("▼ /").IsSelected(), + Equals(" ▼ modules"), + Equals(" D innerSubPath"), + Equals(" M .gitmodules"), ). NavigateToLine(Contains(".gitmodules")) diff --git a/pkg/integration/tests/submodule/reset.go b/pkg/integration/tests/submodule/reset.go index 1521ab6ee..1396ade1b 100644 --- a/pkg/integration/tests/submodule/reset.go +++ b/pkg/integration/tests/submodule/reset.go @@ -71,15 +71,17 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().Focus(). Lines( - Equals(" M my_submodule_path (submodule)"), - Equals("?? other_file").IsSelected(), + Equals("▼ /"), + Equals(" M my_submodule_path (submodule)"), + Equals(" ?? other_file").IsSelected(), ). // Verify we can't use range select on submodules Press(keys.Universal.ToggleRangeSelect). SelectPreviousItem(). Lines( - Equals(" M my_submodule_path (submodule)").IsSelected(), - Equals("?? other_file").IsSelected(), + Equals("▼ /"), + Equals(" M my_submodule_path (submodule)").IsSelected(), + Equals(" ?? other_file").IsSelected(), ). Press(keys.Universal.Remove). Tap(func() { @@ -87,8 +89,9 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ }). Press(keys.Universal.ToggleRangeSelect). Lines( - Equals(" M my_submodule_path (submodule)").IsSelected(), - Equals("?? other_file"), + Equals("▼ /"), + Equals(" M my_submodule_path (submodule)").IsSelected(), + Equals(" ?? other_file"), ). Press(keys.Universal.Remove). Tap(func() { diff --git a/pkg/integration/tests/undo/undo_commit.go b/pkg/integration/tests/undo/undo_commit.go index 04964eba9..7fe61238c 100644 --- a/pkg/integration/tests/undo/undo_commit.go +++ b/pkg/integration/tests/undo/undo_commit.go @@ -57,8 +57,9 @@ var UndoCommit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). Lines( - Equals("A file"), - Equals(" M other-file"), + Equals("▼ /"), + Equals(" A file"), + Equals(" M other-file"), ) t.Views().Commits().Focus(). @@ -84,8 +85,9 @@ var UndoCommit = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().Focus(). Lines( - Equals("A file"), - Equals(" M other-file").IsSelected(), + Equals("▼ /"), + Equals(" A file"), + Equals(" M other-file").IsSelected(), ). Press(keys.Universal.PrevItem). Press(keys.Universal.Remove).