1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Add a command to select all commits of the current branch

This is useful for seeing the combined diff of all commits of a branch.
This commit is contained in:
Stefan Haller
2025-04-01 09:05:45 +02:00
parent 7bccf848af
commit 80b5e21bd5
16 changed files with 159 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectCommitsOfCurrentBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Select all commits of the current branch",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("master 01")
shell.EmptyCommit("master 02")
shell.NewBranch("branch1")
shell.CreateNCommits(2)
shell.NewBranchFrom("branch2", "master")
shell.CreateNCommits(3)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit 03").IsSelected(),
Contains("commit 02"),
Contains("commit 01"),
Contains("master 02"),
Contains("master 01"),
).
Press(keys.Commits.SelectCommitsOfCurrentBranch).
Lines(
Contains("commit 03").IsSelected(),
Contains("commit 02").IsSelected(),
Contains("commit 01").IsSelected(),
Contains("master 02"),
Contains("master 01"),
).
PressEscape().
Lines(
Contains("commit 03").IsSelected(),
Contains("commit 02"),
Contains("commit 01"),
Contains("master 02"),
Contains("master 01"),
)
t.Views().Branches().
Focus().
Lines(
Contains("branch2").IsSelected(),
Contains("branch1"),
Contains("master"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
Contains("master 02"),
Contains("master 01"),
).
Press(keys.Commits.SelectCommitsOfCurrentBranch).
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01").IsSelected(),
Contains("master 02"),
Contains("master 01"),
)
},
})