From 2e72dcb3a6f6d85781d6f4107ff986deabf1b46a Mon Sep 17 00:00:00 2001 From: Tom Amberson <53712733+TommyAmberson@users.noreply.github.com> Date: Fri, 20 Feb 2026 22:15:43 -0600 Subject: [PATCH] Add test for glob_main_branches --- .../tests/branch/glob_main_branches.go | 41 +++++++++++++++++++ pkg/integration/tests/test_list.go | 1 + 2 files changed, 42 insertions(+) create mode 100644 pkg/integration/tests/branch/glob_main_branches.go diff --git a/pkg/integration/tests/branch/glob_main_branches.go b/pkg/integration/tests/branch/glob_main_branches.go new file mode 100644 index 000000000..14ba4adff --- /dev/null +++ b/pkg/integration/tests/branch/glob_main_branches.go @@ -0,0 +1,41 @@ +package branch + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var GlobMainBranches = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Verify that glob patterns in mainBranches config match correctly", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Git.MainBranches = []string{"release/*"} + }, + SetupRepo: func(shell *Shell) { + shell. + EmptyCommit("initial"). + NewBranch("release/1"). + EmptyCommit("release 1 commit"). + NewBranchFrom("feature", "release/1"). + EmptyCommit("feature 1"). + EmptyCommit("feature 2") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains("feature 2").IsSelected(), + Contains("feature 1"), + Contains("release 1 commit"), + Contains("initial"), + ). + Press(keys.Commits.SelectCommitsOfCurrentBranch). + Lines( + Contains("feature 2").IsSelected(), + Contains("feature 1").IsSelected(), + Contains("release 1 commit"), + Contains("initial"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 4d9edaa70..b817d1d87 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -50,6 +50,7 @@ var tests = []*components.IntegrationTest{ branch.DeleteRemoteBranchWithDifferentName, branch.DeleteWhileFiltering, branch.DetachedHead, + branch.GlobMainBranches, branch.MergeFastForward, branch.MergeNonFastForward, branch.MoveCommitsToNewBranchFromBaseBranch,