summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-10-10 08:36:47 +0200
committerGitHub <noreply@github.com>2023-10-10 08:36:47 +0200
commitecaa4846f125ce1420755111f339ad2a574a3fff (patch)
tree85e22a8019f0d1c5dbe43573694c4f7345aa8715
parent013cfc77a1e82316681b2a759d90849cd1593dae (diff)
parent787f9966eca677a47ce9f87ce152fc7f601951a6 (diff)
Fix crash when trying to filter the list of remotes (#3059)
-rw-r--r--pkg/gui/context/remotes_context.go1
-rw-r--r--pkg/integration/tests/filter_and_search/filter_remotes.go42
-rw-r--r--pkg/integration/tests/test_list.go1
3 files changed, 43 insertions, 1 deletions
diff --git a/pkg/gui/context/remotes_context.go b/pkg/gui/context/remotes_context.go
index 38be54149..035fb2321 100644
--- a/pkg/gui/context/remotes_context.go
+++ b/pkg/gui/context/remotes_context.go
@@ -9,7 +9,6 @@ import (
type RemotesContext struct {
*FilteredListViewModel[*models.Remote]
*ListContextTrait
- *SearchHistory
}
var (
diff --git a/pkg/integration/tests/filter_and_search/filter_remotes.go b/pkg/integration/tests/filter_and_search/filter_remotes.go
new file mode 100644
index 000000000..b905a06ed
--- /dev/null
+++ b/pkg/integration/tests/filter_and_search/filter_remotes.go
@@ -0,0 +1,42 @@
+package filter_and_search
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var FilterRemotes = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Filtering remotes",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.EmptyCommit("commit-one")
+ shell.CloneIntoRemote("remote1")
+ shell.CloneIntoRemote("remote2")
+ shell.CloneIntoRemote("remote3")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Remotes().
+ Focus().
+ Lines(
+ Contains("remote1").IsSelected(),
+ Contains("remote2"),
+ Contains("remote3"),
+ ).
+ FilterOrSearch("2").
+ Lines(
+ Contains("remote2").IsSelected(),
+ ).
+ // cancel the filter
+ PressEscape().
+ Tap(func() {
+ t.Views().Search().IsInvisible()
+ }).
+ Lines(
+ Contains("remote1"),
+ Contains("remote2").IsSelected(),
+ Contains("remote3"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index 7759dcda7..521656d10 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -131,6 +131,7 @@ var tests = []*components.IntegrationTest{
filter_and_search.FilterMenu,
filter_and_search.FilterMenuCancelFilterWithEscape,
filter_and_search.FilterRemoteBranches,
+ filter_and_search.FilterRemotes,
filter_and_search.FilterSearchHistory,
filter_and_search.NestedFilter,
filter_and_search.NestedFilterTransient,