1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-10 04:07:18 +02:00

Fix crash when trying to filter the list of remotes (#3059)

This commit is contained in:
Stefan Haller 2023-10-10 08:36:47 +02:00 committed by GitHub
commit ecaa4846f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View File

@ -9,7 +9,6 @@ import (
type RemotesContext struct {
*FilteredListViewModel[*models.Remote]
*ListContextTrait
*SearchHistory
}
var (

View File

@ -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"),
)
},
})

View File

@ -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,