repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go
pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Delete a remote branch where credentials are required", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.CloneIntoRemote("origin") shell.NewBranch("mybranch") shell.PushBranchAndSetUpstream("origin", "mybranch") // actually getting a password prompt is tricky: it requires SSH'ing into localhost under a newly created, restricted, user. // This is not easy to do in a cross-platform way, nor is it easy to do in a docker container. // If you can think of a way to do it, please let me know! shell.CopyHelpFile("pre-push", ".git/hooks/pre-push") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { deleteBranch := func() { t.Views().Branches(). Focus(). Press(keys.Universal.Remove) t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'mybranch'?")). Select(Contains("Delete remote branch")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Delete branch 'mybranch'?")). Content(Equals("Are you sure you want to delete the remote branch 'mybranch' from 'origin'?")). Confirm() } t.Views().Status().Content(Equals("✓ repo → mybranch")) deleteBranch() // correct credentials are: username=username, password=password t.ExpectPopup().Prompt(). Title(Equals("Username")). Type("username"). Confirm() // enter incorrect password t.ExpectPopup().Prompt(). Title(Equals("Password")). Type("incorrect password"). Confirm() t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("incorrect username/password")). Confirm() t.Views().Status().Content(Equals("✓ repo → mybranch")) // try again with correct password deleteBranch() t.ExpectPopup().Prompt(). Title(Equals("Username")). Type("username"). Confirm() t.ExpectPopup().Prompt(). Title(Equals("Password")). Type("password"). Confirm() t.Views().Status().Content(Equals("(upstream gone) repo → mybranch")) t.Views().Branches().TopLines(Contains("mybranch (upstream gone)")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/move_commits_to_new_branch_from_main_branch.go
pkg/integration/tests/branch/move_commits_to_new_branch_from_main_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveCommitsToNewBranchFromMainBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new branch from the commits that you accidentally made on master", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CloneIntoRemote("origin") shell.PushBranchAndSetUpstream("origin", "master") shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("new commit 1") shell.EmptyCommit("new commit 2") shell.UpdateFile("file1", "file1 changed") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). Lines( Contains("M file1"), ) t.Views().Branches(). Focus(). Lines( Contains("master ↑2").IsSelected(), ). Press(keys.Branches.MoveCommitsToNewBranch) t.ExpectPopup().Confirmation(). Title(Equals("Move commits to new branch")). Content(Contains("This will take all unpushed commits and move them to a new branch (off of master).")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("New branch name (branch is off of 'master')")). Type("new branch"). Confirm() t.Views().Branches(). Lines( Contains("new-branch").DoesNotContain("↑").IsSelected(), Contains("master ✓"), ) t.Views().Commits(). Lines( Contains("new commit 2").IsSelected(), Contains("new commit 1"), Contains("initial commit"), ) t.Views().Files(). Lines( Contains("M file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/new_branch_from_remote_tracking_same_name.go
pkg/integration/tests/branch/new_branch_from_remote_tracking_same_name.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var NewBranchFromRemoteTrackingSameName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Set tracking information when creating a new branch from a remote branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit") shell.NewBranch("other_branch") shell.CloneIntoRemote("origin") shell.Checkout("master") shell.RunCommand([]string{"git", "branch", "-D", "other_branch"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Remotes(). Focus(). Lines( Contains("origin").IsSelected(), ). PressEnter() t.Views().RemoteBranches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("other_branch"), ). SelectNextItem(). Press(keys.Universal.New) t.ExpectPopup().Prompt(). Title(Equals("New branch name (branch is off of 'origin/other_branch')")). Confirm() t.Views().Branches(). Focus(). Lines( Contains("other_branch").Contains("✓"), Contains("master"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete_remote_branch_when_tag_with_same_name_exists.go
pkg/integration/tests/branch/delete_remote_branch_when_tag_with_same_name_exists.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DeleteRemoteBranchWhenTagWithSameNameExists = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Delete a remote branch when a remote tag with the same name exists", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CloneIntoRemote("origin") shell.CreateLightweightTag("xyz", "HEAD") shell.PushBranch("origin", "HEAD:refs/tags/xyz") // abusing PushBranch to push a tag shell.PushBranch("origin", "HEAD:refs/heads/xyz") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Remotes(). Focus(). Lines( Contains("origin").IsSelected(), ). PressEnter() t.Views().RemoteBranches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("xyz"), ). SelectNextItem(). Press(keys.Universal.Remove) t.ExpectPopup(). Confirmation(). Title(Equals("Delete branch 'xyz'?")). Content(Equals("Are you sure you want to delete the remote branch 'xyz' from 'origin'?")). Confirm() t.Views().RemoteBranches(). Lines( Contains("master").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/new_branch_with_prefix_using_run_command.go
pkg/integration/tests/branch/new_branch_with_prefix_using_run_command.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var NewBranchWithPrefixUsingRunCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Creating a new branch with a branch prefix using a runCommand", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) { cfg.GetUserConfig().Git.BranchPrefix = "myprefix/{{ runCommand \"echo dynamic\" }}/" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("commit 1") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 1").IsSelected(), ). SelectNextItem(). Press(keys.Universal.New). Tap(func() { t.ExpectPopup().Prompt(). Title(Contains("New branch name")). InitialText(Equals("myprefix/dynamic/")). Type("my-branch"). Confirm() t.Git().CurrentBranchName("myprefix/dynamic/my-branch") }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/reset_to_duplicate_named_upstream.go
pkg/integration/tests/branch/reset_to_duplicate_named_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ResetToDuplicateNamedUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Hard reset the current branch to an upstream branch when there is a competing tag name", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CloneIntoRemote("origin"). NewBranch("foo"). EmptyCommit("commit 1"). PushBranchAndSetUpstream("origin", "foo"). EmptyCommit("commit 2"). CreateLightweightTag("origin/foo", "HEAD") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("commit 2"), Contains("commit 1"), ) t.Views().Tags().Focus().Lines(Contains("origin/foo")) t.Views().Remotes().Focus(). Lines(Contains("origin")). PressEnter() t.Views().RemoteBranches().IsFocused(). Lines(Contains("foo")). Press(keys.Commits.ViewResetOptions) t.ExpectPopup().Menu(). Title(Contains("Reset to origin/foo")). Select(Contains("Hard reset")). Confirm() t.Views().Commits().Lines( Contains("commit 1"), ) t.Views().Tags().Focus(). Lines(Contains("origin/foo")). Press(keys.Commits.ViewResetOptions) t.ExpectPopup().Menu(). Title(Contains("Reset to origin/foo")). Select(Contains("Hard reset")). Confirm() t.Views().Commits().Lines( Contains("commit 2"), Contains("commit 1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete_remote_branch_with_different_name.go
pkg/integration/tests/branch/delete_remote_branch_with_different_name.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DeleteRemoteBranchWithDifferentName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Delete a remote branch that has a different name than the local branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.CloneIntoRemote("origin") shell.NewBranch("mybranch-local") shell.PushBranchAndSetUpstream("origin", "mybranch-local:mybranch-remote") shell.Checkout("master") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), Contains("mybranch-local ✓"), ). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'mybranch-local'?")). Select(Contains("Delete remote branch")). Confirm() }). Tap(func() { t.ExpectPopup(). Confirmation(). Title(Equals("Delete branch 'mybranch-remote'?")). Content(Equals("Are you sure you want to delete the remote branch 'mybranch-remote' from 'origin'?")). Confirm() }). Lines( Contains("master"), Contains("mybranch-local (upstream gone)").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete.go
pkg/integration/tests/branch/delete.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Delete = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try all combination of local and remote branch deletions", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" config.GetUserConfig().Git.RemoteBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell. CloneIntoRemote("origin"). EmptyCommit("blah"). NewBranch("branch-one"). EmptyCommit("on branch-one 01"). PushBranchAndSetUpstream("origin", "branch-one"). EmptyCommit("on branch-one 02"). Checkout("master"). Merge("branch-one"). // branch-one is contained in master, so no delete confirmation NewBranch("branch-two"). EmptyCommit("on branch-two 01"). PushBranchAndSetUpstream("origin", "branch-two"). // branch-two is contained in its own upstream, so no delete confirmation either NewBranchFrom("branch-three", "master"). EmptyCommit("on branch-three 01"). NewBranch("current-head"). // branch-three is contained in the current head, so no delete confirmation EmptyCommit("on current-head"). NewBranchFrom("branch-four", "master"). EmptyCommit("on branch-four 01"). PushBranchAndSetUpstream("origin", "branch-four"). EmptyCommit("on branch-four 02"). // branch-four is not contained in any of these, so we get a delete confirmation NewBranchFrom("branch-five", "master"). EmptyCommit("on branch-five 01"). PushBranchAndSetUpstream("origin", "branch-five"). // branch-five is contained in its own upstream NewBranchFrom("branch-six", "master"). EmptyCommit("on branch-six 01"). PushBranchAndSetUpstream("origin", "branch-six"). EmptyCommit("on branch-six 02"). // branch-six is not contained in any of these, so we get a delete confirmation Checkout("current-head") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("current-head").IsSelected(), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("branch-four ↑1"), Contains("branch-three"), Contains("branch-two ✓"), Contains("master"), Contains("branch-one ↑1"), ). // Deleting the current branch is not possible Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Tooltip(Contains("You cannot delete the checked out branch!")). Title(Equals("Delete branch 'current-head'?")). Select(Contains("Delete local branch")). Confirm(). Tap(func() { t.ExpectToast(Contains("You cannot delete the checked out branch!")) }). Cancel() }). // Delete branch-four. This is the only branch that is not fully merged, so we get // a confirmation popup. NavigateToLine(Contains("branch-four")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-four'?")). Select(Contains("Delete local branch")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Force delete branch")). Content(Equals("'branch-four' is not fully merged. Are you sure you want to delete it?")). Confirm() }). Lines( Contains("current-head"), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("branch-three").IsSelected(), Contains("branch-two ✓"), Contains("master"), Contains("branch-one ↑1"), ). // Delete branch-three. This branch is contained in the current head, so this just works // without any confirmation. Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-three'?")). Select(Contains("Delete local branch")). Confirm() }). Lines( Contains("current-head"), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("branch-two ✓").IsSelected(), Contains("master"), Contains("branch-one ↑1"), ). // Delete branch-two. This branch is contained in its own upstream, so this just works // without any confirmation. Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-two'?")). Select(Contains("Delete local branch")). Confirm() }). Lines( Contains("current-head"), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("master").IsSelected(), Contains("branch-one ↑1"), ). // Delete remote branch of branch-one. We only get the normal remote branch confirmation for this one. SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-one'?")). Select(Contains("Delete remote branch")). Confirm() }). Tap(func() { t.ExpectPopup(). Confirmation(). Title(Equals("Delete branch 'branch-one'?")). Content(Equals("Are you sure you want to delete the remote branch 'branch-one' from 'origin'?")). Confirm() }). Tap(func() { checkRemoteBranches(t, keys, "origin", []string{ "branch-five", "branch-four", "branch-six", "branch-two", }) }). Lines( Contains("current-head"), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("master"), Contains("branch-one (upstream gone)").IsSelected(), ). // Delete local branch of branch-one. Even though its upstream is gone, we don't get a confirmation // because it is contained in master. Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-one'?")). Select(Contains("Delete local branch")). Confirm() }). Lines( Contains("current-head"), Contains("branch-six ↑1"), Contains("branch-five ✓"), Contains("master").IsSelected(), ). // Delete both local and remote branch of branch-six. We get the force-delete warning because it is not fully merged. NavigateToLine(Contains("branch-six")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-six'?")). Select(Contains("Delete local and remote branch")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Delete local and remote branch")). Content(Contains("Are you sure you want to delete both 'branch-six' from your machine, and 'branch-six' from 'origin'?"). Contains("'branch-six' is not fully merged. Are you sure you want to delete it?")). Confirm() }). Lines( Contains("current-head"), Contains("branch-five ✓").IsSelected(), Contains("master"), ). // Delete both local and remote branch of branch-five. We get the same popups, but the confirmation // doesn't contain the force-delete warning. Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch-five'?")). Select(Contains("Delete local and remote branch")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Delete local and remote branch")). Content(Equals("Are you sure you want to delete both 'branch-five' from your machine, and 'branch-five' from 'origin'?"). DoesNotContain("not fully merged")). Confirm() }). Lines( Contains("current-head"), Contains("master").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/move_commits_to_new_branch_keep_stacked.go
pkg/integration/tests/branch/move_commits_to_new_branch_keep_stacked.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveCommitsToNewBranchKeepStacked = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new branch from the commits that you accidentally made on the wrong branch; choosing stacked on current branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.BranchPrefix = "myprefix/" }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CloneIntoRemote("origin") shell.PushBranchAndSetUpstream("origin", "master") shell.NewBranch("feature") shell.EmptyCommit("feature branch commit") shell.PushBranchAndSetUpstream("origin", "feature") shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("new commit 1") shell.EmptyCommit("new commit 2") shell.UpdateFile("file1", "file1 changed") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). Lines( Contains("M file1"), ) t.Views().Branches(). Focus(). Lines( Contains("feature ↑2").IsSelected(), Contains("master ✓"), ). Press(keys.Branches.MoveCommitsToNewBranch) t.ExpectPopup().Menu(). Title(Equals("Move commits to new branch")). Select(Contains("New branch stacked on current branch (feature)")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("New branch name (branch is off of 'feature')")). InitialText(Equals("myprefix/")). Type("new branch"). Confirm() t.Views().Branches(). Lines( Contains("myprefix/new-branch").DoesNotContain("↑").IsSelected(), Contains("feature ✓"), Contains("master ✓"), ) t.Views().Commits(). Lines( Contains("new commit 2").IsSelected(), Contains("new commit 1"), Contains("* feature branch commit"), Contains("initial commit"), ) t.Views().Files(). Lines( Contains("M file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_does_not_autosquash.go
pkg/integration/tests/branch/rebase_does_not_autosquash.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseDoesNotAutosquash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase a branch that has fixups onto another branch, and verify that the fixups are not squashed even if rebase.autoSquash is enabled globally.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.SetConfig("rebase.autoSquash", "true") shell. EmptyCommit("base"). NewBranch("my-branch"). Checkout("master"). EmptyCommit("master commit"). Checkout("my-branch"). EmptyCommit("branch commit"). EmptyCommit("fixup! branch commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Lines( Contains("fixup! branch commit"), Contains("branch commit"), Contains("base"), ) t.Views().Branches(). Focus(). Lines( Contains("my-branch").IsSelected(), Contains("master"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'my-branch'")). Select(Contains("Simple rebase")). Confirm() t.Views().Commits().Lines( Contains("fixup! branch commit"), Contains("branch commit"), Contains("master commit"), Contains("base"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/open_with_cli_arg.go
pkg/integration/tests/branch/open_with_cli_arg.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var OpenWithCliArg = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Open straight to branches panel using a CLI arg", ExtraCmdArgs: []string{"branch"}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches().IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/checkout_by_name.go
pkg/integration/tests/branch/checkout_by_name.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try to checkout branch by name. Verify that it also works on the branch with the special name @.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). NewBranch("@"). Checkout("master"). EmptyCommit("blah") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), Contains("@"), ). SelectNextItem(). Press(keys.Branches.CheckoutBranchByName). Tap(func() { t.ExpectPopup().Prompt().Title(Equals("Branch name:")).Type("new-branch").Confirm() t.ExpectPopup().Alert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm() }). Lines( MatchesRegexp(`\*.*new-branch`).IsSelected(), Contains("@"), Contains("master"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/open_pull_request_invalid_target_remote_name.go
pkg/integration/tests/branch/open_pull_request_invalid_target_remote_name.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var OpenPullRequestInvalidTargetRemoteName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Open up a pull request, specifying a non-existing target remote", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { // Create an initial commit ('git branch set-upstream-to' bails out otherwise) shell.CreateFileAndAdd("file", "content1") shell.Commit("one") // Create a new branch shell.NewBranch("branch-1") // Create a couple of remotes shell.CloneIntoRemote("upstream") shell.CloneIntoRemote("origin") // To allow a pull request to be created from a branch, it must have an upstream set. shell.SetBranchUpstream("branch-1", "origin/branch-1") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // Open a PR for the current branch (i.e. 'branch-1') t.Views(). Branches(). Focus(). Press(keys.Branches.ViewPullRequestOptions) t.ExpectPopup(). Menu(). Title(Equals("View create pull request options")). Select(Contains("Select branch")). Confirm() // Verify that we're prompted to enter the remote and enter the name of a non-existing one. t.ExpectPopup(). Prompt(). Title(Equals("Select target remote")). Type("non-existing-remote"). Confirm() // Verify that this leads to an error being shown (instead of progressing to branch selection). t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("A remote named 'non-existing-remote' does not exist")). Confirm() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/show_divergence_from_upstream.go
pkg/integration/tests/branch/show_divergence_from_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ShowDivergenceFromUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Show divergence from upstream", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file", "content1") shell.Commit("one") shell.UpdateFileAndAdd("file", "content2") shell.Commit("two") shell.CreateFileAndAdd("file3", "content3") shell.Commit("three") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("master", "origin/master") shell.HardReset("HEAD^^") shell.CreateFileAndAdd("file4", "content4") shell.Commit("four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Lines( Contains("four"), Contains("one"), ) t.Views().Branches(). Focus(). Lines(Contains("master")). Press(keys.Branches.SetUpstream) t.ExpectPopup().Menu().Title(Contains("Upstream")).Select(Contains("View divergence from upstream")).Confirm() t.Views().SubCommits(). IsFocused(). Title(Contains("Commits (master <-> origin/master)")). Lines( DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"), Contains("↓").Contains("three"), Contains("↓").Contains("two"), DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"), Contains("↑").Contains("four"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/unset_upstream.go
pkg/integration/tests/branch/unset_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var UnsetUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Unset upstream of selected branch, both when it exists and when it doesn't", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("one"). NewBranch("branch_to_remove"). Checkout("master"). CloneIntoRemote("origin"). SetBranchUpstream("master", "origin/master"). SetBranchUpstream("branch_to_remove", "origin/branch_to_remove"). // to get the "(upstream gone)" branch status RunCommand([]string{"git", "push", "origin", "--delete", "branch_to_remove"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Press(keys.Universal.NextScreenMode). // we need to enlargen the window to see the upstream SelectedLines( Contains("master").Contains("origin master"), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Unset upstream of selected branch")). Confirm() }). SelectedLines( Contains("master").DoesNotContain("origin master"), ) t.Views().Branches(). Focus(). SelectNextItem(). SelectedLines( Contains("branch_to_remove").Contains("origin branch_to_remove").Contains("upstream gone"), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Unset upstream of selected branch")). Confirm() }). SelectedLines( Contains("branch_to_remove").DoesNotContain("origin branch_to_remove").DoesNotContain("upstream gone"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/suggestions.go
pkg/integration/tests/branch/suggestions.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Checking out a branch with name suggestions", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("my commit message"). NewBranch("new-branch"). NewBranch("new-branch-2"). NewBranch("new-branch-3"). NewBranch("branch-to-checkout"). NewBranch("other-new-branch-2"). NewBranch("other-new-branch-3") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Press(keys.Branches.CheckoutBranchByName) // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in t.ExpectPopup().Prompt(). Title(Equals("Branch name:")). Type("branch-to"). SuggestionTopLines(Contains("branch-to-checkout")). ConfirmFirstSuggestion() t.Git().CurrentBranchName("branch-to-checkout") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_onto_base_branch.go
pkg/integration/tests/branch/rebase_onto_base_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseOntoBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase the current branch onto its base branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Gui.ShowDivergenceFromBaseBranch = "arrowAndNumber" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("master 1"). EmptyCommit("master 2"). EmptyCommit("master 3"). NewBranchFrom("feature", "master^"). EmptyCommit("feature 1"). EmptyCommit("feature 2") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("feature 2"), Contains("feature 1"), Contains("master 2"), Contains("master 1"), ) t.Views().Branches(). Focus(). Lines( MatchesRegexp(`feature\s+↓1`).IsSelected(), Contains("master"), ). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'feature'")). Select(Contains("Rebase onto base branch (master)")). Confirm() t.Views().Commits().Lines( Contains("feature 2"), Contains("feature 1"), Contains("master 3"), Contains("master 2"), Contains("master 1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/new_branch_from_remote_tracking_different_name.go
pkg/integration/tests/branch/new_branch_from_remote_tracking_different_name.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var NewBranchFromRemoteTrackingDifferentName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Set tracking information when creating a new branch from a remote branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit") shell.NewBranch("other_branch") shell.CloneIntoRemote("origin") shell.Checkout("master") shell.RunCommand([]string{"git", "branch", "-D", "other_branch"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Remotes(). Focus(). Lines( Contains("origin").IsSelected(), ). PressEnter() t.Views().RemoteBranches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("other_branch"), ). SelectNextItem(). Press(keys.Universal.New) t.ExpectPopup().Prompt(). Title(Equals("New branch name (branch is off of 'origin/other_branch')")). Clear(). Type("different_name"). Confirm() t.Views().Branches(). Focus(). Lines( Contains("different_name").DoesNotContain("✓"), Contains("master"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/select_commits_of_current_branch.go
pkg/integration/tests/branch/select_commits_of_current_branch.go
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"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/reset_to_duplicate_named_tag.go
pkg/integration/tests/branch/reset_to_duplicate_named_tag.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ResetToDuplicateNamedTag = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Hard reset to a branch when a tag shares the same name", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("current-branch") shell.EmptyCommit("other-branch-tag commit") shell.CreateLightweightTag("other-branch", "HEAD") shell.EmptyCommit("other-branch commit") shell.NewBranch("other-branch") shell.Checkout("current-branch") shell.EmptyCommit("current-branch commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("current-branch commit"), Contains("other-branch commit"), Contains("other-branch-tag commit"), ) t.Views().Branches(). Focus(). Lines( Contains("current-branch").IsSelected(), Contains("other-branch"), ). SelectNextItem(). Press(keys.Commits.ViewResetOptions) t.ExpectPopup().Menu(). Title(Contains("Reset to other-branch")). Select(Contains("Hard reset")). Confirm() t.Views().Commits(). Lines( Contains("other-branch commit"), Contains("other-branch-tag commit"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/shared.go
pkg/integration/tests/branch/shared.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/samber/lo" ) func checkRemoteBranches(t *TestDriver, keys config.KeybindingConfig, remoteName string, expectedBranches []string) { t.Views().Remotes(). Focus(). NavigateToLine(Contains(remoteName)). PressEnter() t.Views(). RemoteBranches(). Lines( lo.Map(expectedBranches, func(branch string, _ int) *TextMatcher { return Equals(branch) })..., ). Press(keys.Universal.Return) t.Views(). Branches(). Focus() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/merge_fast_forward.go
pkg/integration/tests/branch/merge_fast_forward.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MergeFastForward = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Merge a branch into another using fast-forward merge", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell.NewBranch("original-branch"). EmptyCommit("one"). NewBranch("branch1"). EmptyCommit("branch1"). Checkout("original-branch"). NewBranchFrom("branch2", "original-branch"). EmptyCommit("branch2"). Checkout("original-branch") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("original-branch").IsSelected(), Contains("branch1"), Contains("branch2"), ). SelectNextItem(). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). TopLines( Contains("Regular merge (fast-forward)"), Contains("Regular merge (with merge commit)"), ). Select(Contains("Regular merge (fast-forward)")). Confirm() t.Views().Commits(). Lines( Contains("branch1").IsSelected(), Contains("one"), ) // Check that branch2 can't be merged using fast-forward t.Views().Branches(). Focus(). NavigateToLine(Contains("branch2")). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). TopLines( Contains("Regular merge (with merge commit)"), Contains("Regular merge (fast-forward)"), ). Select(Contains("Regular merge (fast-forward)")). Confirm() t.ExpectToast(Contains("Cannot fast-forward 'original-branch' to 'branch2'")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/show_divergence_from_upstream_no_divergence.go
pkg/integration/tests/branch/show_divergence_from_upstream_no_divergence.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ShowDivergenceFromUpstreamNoDivergence = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Show divergence from upstream when the divergence view is empty", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit1") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("master", "origin/master") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines(Contains("master")). Press(keys.Branches.SetUpstream) t.ExpectPopup().Menu().Title(Contains("Upstream")).Select(Contains("View divergence from upstream")).Confirm() t.Views().SubCommits(). IsFocused(). Title(Contains("Commits (master <-> origin/master)")). Lines( Contains("--- Remote ---"), Contains("--- Local ---"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_and_drop.go
pkg/integration/tests/branch/rebase_and_drop.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch, deal with the conflicts. Also mark a commit to be dropped before continuing.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) // adding a couple additional commits so that we can drop one shell.EmptyCommit("to remove") shell.EmptyCommit("to keep") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). TopLines( Contains("to keep"), Contains("to remove"), Contains("first change"), Contains("original"), ) t.Views().Branches(). Focus(). Lines( Contains("first-change-branch").IsSelected(), Contains("second-change-branch"), Contains("original-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'first-change-branch'")). Select(Contains("Simple rebase")). Confirm() t.Views().Information().Content(Contains("Rebasing")) t.Common().AcknowledgeConflicts() t.Views().Files().IsFocused(). SelectedLine(MatchesRegexp("UU.*file")) t.Views().Commits(). Focus(). TopLines( Contains("--- Pending rebase todos ---"), MatchesRegexp(`pick.*to keep`).IsSelected(), MatchesRegexp(`pick.*to remove`), MatchesRegexp(`pick.*CONFLICT.*first change`), Contains("--- Commits ---"), MatchesRegexp("second-change-branch unrelated change"), MatchesRegexp("second change"), MatchesRegexp("original"), ). SelectNextItem(). Press(keys.Universal.Remove). TopLines( Contains("--- Pending rebase todos ---"), MatchesRegexp(`pick.*to keep`), MatchesRegexp(`drop.*to remove`).IsSelected(), MatchesRegexp(`pick.*CONFLICT.*first change`), Contains("--- Commits ---"), MatchesRegexp("second-change-branch unrelated change"), MatchesRegexp("second change"), MatchesRegexp("original"), ) t.Views().Files(). Focus(). PressEnter() t.Views().MergeConflicts(). IsFocused(). PressPrimaryAction() t.Common().ContinueOnConflictsResolved("rebase") t.Views().Information().Content(DoesNotContain("Rebasing")) t.Views().Commits().TopLines( Contains("to keep"), Contains("second-change-branch unrelated change").IsSelected(), Contains("second change"), Contains("original"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase.go
pkg/integration/tests/branch/rebase.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch, deal with the conflicts.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("first change"), Contains("original"), ) t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), Contains("second-change-branch"), Contains("original-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'first-change-branch'")). Select(Contains("Simple rebase")). Confirm() t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). SelectedLine(Contains("file")). PressEnter() t.Views().MergeConflicts(). IsFocused(). PressPrimaryAction() t.Views().Information().Content(Contains("Rebasing")) t.Common().ContinueOnConflictsResolved("rebase") t.Views().Information().Content(DoesNotContain("Rebasing")) t.Views().Commits().TopLines( Contains("second-change-branch unrelated change"), Contains("second change"), Contains("original"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go
pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var RebaseConflictsFixBuildErrors = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch, deal with the conflicts. While continue prompt is showing, fix build errors; get another prompt when continuing.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("first change"), Contains("original"), ) t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), Contains("second-change-branch"), Contains("original-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'first-change-branch'")). Select(Contains("Simple rebase")). Confirm() t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). SelectedLine(Contains("file")). PressEnter() t.Views().MergeConflicts(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Rebasing")) popup := t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("All merge conflicts resolved. Continue the rebase?")) // While the popup is showing, fix some build errors t.Shell().UpdateFile("file", "make it compile again") // Continue popup.Confirm() t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("Files have been modified since conflicts were resolved. Auto-stage them and continue?")). Confirm() t.Views().Information().Content(DoesNotContain("Rebasing")) t.Views().Commits().TopLines( Contains("first change"), Contains("second-change-branch unrelated change"), Contains("second change"), Contains("original"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/detached_head.go
pkg/integration/tests/branch/detached_head.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DetachedHead = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new branch on detached head", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(10). Checkout("HEAD^") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( MatchesRegexp(`\*.*HEAD`).IsSelected(), MatchesRegexp(`master`), ). Press(keys.Universal.New) t.ExpectPopup().Prompt(). Title(MatchesRegexp(`^New branch name \(branch is off of '[0-9a-f]+'\)$`)). Type("new-branch"). Confirm() t.Views().Branches(). Lines( MatchesRegexp(`\* new-branch`).IsSelected(), MatchesRegexp(`master`), ) t.Git().CurrentBranchName("new-branch") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/open_pull_request_select_remote_and_target_branch.go
pkg/integration/tests/branch/open_pull_request_select_remote_and_target_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var OpenPullRequestSelectRemoteAndTargetBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Open up a pull request, specifying a remote and target branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().OS.OpenLink = "echo {{link}} > /tmp/openlink" }, SetupRepo: func(shell *Shell) { // Create an initial commit ('git branch set-upstream-to' bails out otherwise) shell.CreateFileAndAdd("file", "content1") shell.Commit("one") // Create a new branch and a remote that has that branch shell.NewBranch("branch-1") shell.CloneIntoRemote("upstream") // Create another branch and a second remote. The first remote doesn't have this branch. shell.NewBranch("branch-2") shell.CloneIntoRemote("origin") // To allow a pull request to be created from a branch, it must have an upstream set. shell.SetBranchUpstream("branch-2", "origin/branch-2") shell.RunCommand([]string{"git", "remote", "set-url", "origin", "https://github.com/my-personal-fork/lazygit"}) shell.RunCommand([]string{"git", "remote", "set-url", "upstream", "https://github.com/jesseduffield/lazygit"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // Open a PR for the current branch (i.e. 'branch-2') t.Views(). Branches(). Focus(). Press(keys.Branches.ViewPullRequestOptions) t.ExpectPopup(). Menu(). Title(Equals("View create pull request options")). Select(Contains("Select branch")). Confirm() // Verify that we're prompted to enter the remote t.ExpectPopup(). Prompt(). Title(Equals("Select target remote")). SuggestionLines( Equals("origin"), Equals("upstream")). ConfirmSuggestion(Equals("upstream")) // Verify that we're prompted to enter the target branch and that only those branches // present in the selected remote are listed as suggestions (i.e. 'branch-2' is not there). t.ExpectPopup(). Prompt(). Title(Equals("branch-2 → upstream/")). SuggestionLines( Equals("branch-1"), Equals("master")). ConfirmSuggestion(Equals("master")) // Verify that the expected URL is used (by checking the openlink file) // // Please note that when targeting a different remote - like it's done here in this test - // the link is not yet correct. Thus, this test is expected to fail once this is fixed. t.FileSystem().FileContent( "/tmp/openlink", Equals("https://github.com/my-personal-fork/lazygit/compare/master...branch-2?expand=1\n")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/new_branch_autostash.go
pkg/integration/tests/branch/new_branch_autostash.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var NewBranchAutostash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new branch that requires performing autostash", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file", "a\n\nb") shell.Commit("add file") shell.UpdateFileAndAdd("file", "a\n\nc") shell.Commit("edit last line") shell.Checkout("HEAD^") shell.UpdateFile("file", "b\n\nb") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). Lines( Contains("file"), ) t.Views().Branches(). Focus(). Lines( MatchesRegexp(`\*.*HEAD`).IsSelected(), Contains("master"), ). NavigateToLine(Contains("master")). Press(keys.Universal.New) t.ExpectPopup().Prompt(). Title(Contains("New branch name (branch is off of 'master')")). Type("new-branch"). Confirm() t.ExpectPopup().Confirmation(). Title(Contains("Autostash?")). Content(Contains("You must stash and pop your changes to bring them across. Do this automatically? (enter/esc)")). Confirm() t.Views().Branches(). Lines( Contains("new-branch").IsSelected(), Contains("master"), ) t.Git().CurrentBranchName("new-branch") t.Views().Files(). Lines( Contains("file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/create_tag.go
pkg/integration/tests/branch/create_tag.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new tag on branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(10). NewBranch("new-branch"). EmptyCommit("new commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( MatchesRegexp(`\*\s*new-branch`).IsSelected(), MatchesRegexp(`master`), ). SelectNextItem(). Press(keys.Branches.CreateTag) t.ExpectPopup().CommitMessagePanel(). Title(Equals("Tag name")). Type("new-tag"). Confirm() t.Views().Tags().Focus(). Lines( MatchesRegexp(`new-tag`).IsSelected(), ) t.Git(). TagNamesAt("HEAD", []string{}). TagNamesAt("master", []string{"new-tag"}) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_from_marked_base.go
pkg/integration/tests/branch/rebase_from_marked_base.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseFromMarkedBase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch from a marked base commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shell. NewBranch("base-branch"). EmptyCommit("one"). EmptyCommit("two"). EmptyCommit("three"). NewBranch("active-branch"). EmptyCommit("active one"). EmptyCommit("active two"). EmptyCommit("active three"). Checkout("base-branch"). NewBranch("target-branch"). EmptyCommit("target one"). EmptyCommit("target two"). Checkout("active-branch") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("active three"), Contains("active two"), Contains("active one"), Contains("three"), Contains("two"), Contains("one"), ). NavigateToLine(Contains("active one")). Press(keys.Commits.MarkCommitAsBaseForRebase). Lines( Contains("active three").Contains("✓"), Contains("active two").Contains("✓"), Contains("↑↑↑ Will rebase from here ↑↑↑ active one"), Contains("three").DoesNotContain("✓"), Contains("two").DoesNotContain("✓"), Contains("one").DoesNotContain("✓"), ) t.Views().Information().Content(Contains("Marked a base commit for rebase")) t.Views().Branches(). Focus(). Lines( Contains("active-branch"), Contains("target-branch"), Contains("base-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'active-branch' from marked base")). Select(Contains("Simple rebase")). Confirm() t.Views().Commits().Lines( Contains("active three").DoesNotContain("✓"), Contains("active two").DoesNotContain("✓"), Contains("target two").DoesNotContain("✓"), Contains("target one").DoesNotContain("✓"), Contains("three").DoesNotContain("✓"), Contains("two").DoesNotContain("✓"), Contains("one").DoesNotContain("✓"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rename.go
pkg/integration/tests/branch/rename.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Rename = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rename a branch, replacing spaces in the name with dashes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("master"), ). Press(keys.Branches.RenameBranch). Tap(func() { t.ExpectPopup().Prompt(). Title(Contains("Enter new branch name")). InitialText(Equals("master")). Clear(). Type("new branch name"). Confirm() }). Lines( Contains("new-branch-name"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/squash_merge.go
pkg/integration/tests/branch/squash_merge.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashMerge = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Squash merge a branch both with and without committing", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("original-branch"). EmptyCommit("one"). NewBranch("change-worktree-branch"). CreateFileAndAdd("work", "content"). Commit("work"). Checkout("original-branch"). NewBranch("change-commit-branch"). CreateFileAndAdd("file", "content"). Commit("file"). Checkout("original-branch") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("one"), ) t.Views().Branches(). Focus(). Lines( Contains("original-branch").IsSelected(), Contains("change-commit-branch"), Contains("change-worktree-branch"), ). SelectNextItem(). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). Select(Contains("Squash merge and commit")). Confirm() t.Views().Commits().TopLines( Contains("Squash merge change-commit-branch into original-branch"), Contains("one"), ) t.Views().Branches(). Focus(). NavigateToLine(Contains("change-worktree-branch")). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). Select(Contains("Squash merge and leave uncommitted")). Confirm() t.Views().Files().Focus().Lines( Contains("work"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/merge_non_fast_forward.go
pkg/integration/tests/branch/merge_non_fast_forward.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MergeNonFastForward = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Merge a branch into another using non-fast-forward merge", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell.NewBranch("original-branch"). EmptyCommit("one"). NewBranch("branch1"). EmptyCommit("branch1"). Checkout("original-branch"). NewBranchFrom("branch2", "original-branch"). EmptyCommit("branch2"). Checkout("original-branch") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("original-branch").IsSelected(), Contains("branch1"), Contains("branch2"), ). SelectNextItem(). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). TopLines( Contains("Regular merge (fast-forward)"), Contains("Regular merge (with merge commit)"), ). Select(Contains("Regular merge (with merge commit)")). Confirm() t.Views().Commits(). Lines( Contains("⏣─╮ Merge branch 'branch1' into original-branch").IsSelected(), Contains("│ ◯ * branch1"), Contains("◯─╯ one"), ) // Check that branch2 shows the non-fast-forward option first t.Views().Branches(). Focus(). NavigateToLine(Contains("branch2")). Press(keys.Branches.MergeIntoCurrentBranch) t.ExpectPopup().Menu(). Title(Equals("Merge")). TopLines( Contains("Regular merge (with merge commit)"), Contains("Regular merge (fast-forward)"), ). Select(Contains("Regular merge (with merge commit)")). Confirm() t.Views().Commits(). Lines( Contains("⏣─╮ Merge branch 'branch2' into original-branch").IsSelected(), Contains("│ ◯ * branch2"), Contains("⏣─│─╮ Merge branch 'branch1' into original-branch"), Contains("│ │ ◯ * branch1"), Contains("◯─┴─╯ one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/checkout_previous_branch.go
pkg/integration/tests/branch/checkout_previous_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CheckoutPreviousBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Checkout to the previous branch using the checkout previous branch functionality", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). NewBranch("previous-branch"). EmptyCommit("previous commit"). Checkout("master"). EmptyCommit("master commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), Contains("previous-branch"), ) // Press the checkout previous branch key (should checkout previous-branch) t.Views().Branches(). Press(keys.Branches.CheckoutPreviousBranch). Lines( Contains("previous-branch").IsSelected(), Contains("master"), ) // Verify we're on previous-branch t.Git().CurrentBranchName("previous-branch") // Press again to go back to master t.Views().Branches(). Press(keys.Branches.CheckoutPreviousBranch). Lines( Contains("master").IsSelected(), Contains("previous-branch"), ) // Verify we're back on master t.Git().CurrentBranchName("master") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete_while_filtering.go
pkg/integration/tests/branch/delete_while_filtering.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) // Regression test for deleting the last branch in the unfiltered list while // filtering is on. This used to cause a segfault. var DeleteWhileFiltering = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Delete a local branch while there's a filter in the branches panel", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.NewBranch("branch1") shell.NewBranch("branch2") shell.Checkout("master") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), Contains("branch1"), Contains("branch2"), ). FilterOrSearch("branch"). Lines( Contains("branch1").IsSelected(), Contains("branch2"), ). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete branch 'branch2'?")). Select(Contains("Delete local branch")). Confirm() }). Lines( Contains("branch1").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/sort_local_branches.go
pkg/integration/tests/branch/sort_local_branches.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SortLocalBranches = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Sort local branches by recency, date or alphabetically", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("commit"). NewBranch("first"). EmptyCommitWithDate("commit", "2023-04-07 10:00:00"). NewBranch("second"). EmptyCommitWithDate("commit", "2023-04-07 12:00:00"). NewBranch("third"). EmptyCommitWithDate("commit", "2023-04-07 11:00:00"). Checkout("master") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // sorted by date by default t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), Contains("second"), Contains("third"), Contains("first"), ). SelectNextItem() // to test that the selection jumps back to the top when sorting t.Views().Branches(). Press(keys.Branches.SortOrder) t.ExpectPopup().Menu().Title(Equals("Sort order")). ContainsLines( Contains("r ( ) Recency").IsSelected(), Contains("a ( ) Alphabetical"), Contains("d (•) Date"), Contains(" Cancel"), ). Select(Contains("Recency")). Confirm() t.Views().Branches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("third"), Contains("second"), Contains("first"), ) t.Views().Branches(). Press(keys.Branches.SortOrder) t.ExpectPopup().Menu().Title(Equals("Sort order")). ContainsLines( Contains("r (•) Recency").IsSelected(), Contains("a ( ) Alphabetical"), Contains("d ( ) Date"), Contains(" Cancel"), ). Select(Contains("refname")). Confirm() t.Views().Branches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("first"), Contains("second"), Contains("third"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/reset_to_upstream.go
pkg/integration/tests/branch/reset_to_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ResetToUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Hard reset the current branch to the selected branch upstream", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shell. CloneIntoRemote("origin"). NewBranch("hard-branch"). EmptyCommit("hard commit"). PushBranchAndSetUpstream("origin", "hard-branch"). NewBranch("soft-branch"). EmptyCommit("soft commit"). PushBranchAndSetUpstream("origin", "soft-branch"). RenameCurrentBranch("soft-branch-local"). NewBranch("base"). EmptyCommit("base-branch commit"). CreateFile("file-1", "content"). GitAdd("file-1"). Commit("commit with file"). CreateFile("file-2", "content"). GitAdd("file-2") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // soft reset t.Views().Branches(). Focus(). Lines( Contains("base").IsSelected(), Contains("soft-branch-local"), Contains("hard-branch"), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Reset checked-out branch onto upstream of selected branch")). Tooltip(Contains("Disabled: The selected branch has no upstream (or the upstream is not stored locally)")). Confirm(). Tap(func() { t.ExpectToast(Equals("Disabled: The selected branch has no upstream (or the upstream is not stored locally)")) }). Cancel() }). SelectNextItem(). Lines( Contains("base"), Contains("soft-branch-local").IsSelected(), Contains("hard-branch"), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Reset checked-out branch onto origin/soft-branch...")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Reset to origin/soft-branch")). Select(Contains("Soft reset")). Confirm() }) t.Views().Commits().Lines( Contains("soft commit"), Contains("hard commit"), ) t.Views().Files().Lines( Equals("▼ /"), Equals(" A file-1"), Equals(" A file-2"), ) // hard reset t.Views().Branches(). Focus(). Lines( Contains("base"), Contains("soft-branch-local").IsSelected(), Contains("hard-branch"), ). NavigateToLine(Contains("hard-branch")). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Reset checked-out branch onto origin/hard-branch...")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Reset to origin/hard-branch")). Select(Contains("Hard reset")). Confirm() t.ExpectPopup().Confirmation(). Title(Equals("Hard reset")). Content(Contains("Are you sure you want to do a hard reset?")). Confirm() }) t.Views().Commits().Lines(Contains("hard commit")) t.Views().Files().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/show_divergence_from_base_branch.go
pkg/integration/tests/branch/show_divergence_from_base_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ShowDivergenceFromBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Show divergence from base branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Gui.ShowDivergenceFromBaseBranch = "arrowAndNumber" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("master 1"). EmptyCommit("master 2"). EmptyCommit("master 3"). NewBranchFrom("feature", "master^"). EmptyCommit("feature 1"). EmptyCommit("feature 2") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( MatchesRegexp(`feature\s+↓1`).IsSelected(), Contains("master"), ). Press(keys.Branches.SetUpstream) t.ExpectPopup().Menu().Title(Contains("Upstream")). Select(Contains("View divergence from base branch (master)")).Confirm() t.Views().SubCommits(). IsFocused(). Title(Contains("Commits (feature <-> master)")). Lines( DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"), Contains("↓").Contains("master 3"), DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"), Contains("↑").Contains("feature 2"), Contains("↑").Contains("feature 1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/set_upstream.go
pkg/integration/tests/branch/set_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SetUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Set the upstream of a branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.CloneIntoRemote("origin") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Press(keys.Universal.NextScreenMode). // we need to enlargen the window to see the upstream Lines( Contains("master").DoesNotContain("origin master").IsSelected(), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains(" Set upstream of selected branch")). // using leading space to disambiguate from the 'reset' option Confirm() t.ExpectPopup().Prompt(). Title(Equals("Enter upstream as '<remote> <branchname>'")). SuggestionLines(Equals("origin master")). ConfirmFirstSuggestion() }). Lines( Contains("master").Contains("origin master").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_abort_on_conflict.go
pkg/integration/tests/branch/rebase_abort_on_conflict.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var RebaseAbortOnConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch, abort when there are conflicts.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("first change"), Contains("original"), ) t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), Contains("second-change-branch"), Contains("original-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'first-change-branch'")). Select(Contains("Simple rebase")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Conflicts!")). Select(Contains("Abort the rebase")). Confirm() t.Views().Branches(). IsFocused() t.Views().Files(). IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/sort_remote_branches.go
pkg/integration/tests/branch/sort_remote_branches.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SortRemoteBranches = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Sort remote branches alphabetically or by date", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("first") shell.EmptyCommitWithDate("commit", "2023-04-07 10:00:00") shell.NewBranch("second") shell.EmptyCommitWithDate("commit", "2023-04-07 12:00:00") shell.NewBranch("third") shell.EmptyCommitWithDate("commit", "2023-04-07 11:00:00") shell.CloneIntoRemote("origin") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Remotes(). Focus(). Lines( Contains("origin").IsSelected(), ). PressEnter() // sorted by date by default t.Views().RemoteBranches(). IsFocused(). Lines( Contains("second").IsSelected(), Contains("third"), Contains("first"), ). SelectNextItem() // to test that the selection jumps back to the first when sorting t.Views().RemoteBranches(). Press(keys.Branches.SortOrder) t.ExpectPopup().Menu().Title(Equals("Sort order")). ContainsLines( Contains("a ( ) Alphabetical").IsSelected(), Contains("d (•) Date"), Contains(" Cancel"), ). Select(Contains("Alphabetical")). Confirm() t.Views().RemoteBranches(). IsFocused(). Lines( Contains("first").IsSelected(), Contains("second"), Contains("third"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/undo/undo_checkout_and_drop.go
pkg/integration/tests/undo/undo_checkout_and_drop.go
package undo import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var UndoCheckoutAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop some commits and then undo/redo the actions", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.EmptyCommit("four") shell.NewBranch("other_branch") shell.Checkout("master") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // we're going to drop a commit, switch branch, drop a commit there, then undo everything, then redo everything. confirmCommitDrop := func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected commit(s)?")). Confirm() } confirmUndoDrop := func() { t.ExpectPopup().Confirmation(). Title(Equals("Undo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Confirm() } confirmRedoDrop := func() { t.ExpectPopup().Confirmation(). Title(Equals("Redo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Confirm() } t.Views().Commits().Focus(). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Remove). Tap(confirmCommitDrop). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ) t.Views().Branches().Focus(). Lines( Contains("master").IsSelected(), Contains("other_branch"), ). SelectNextItem(). // checkout branch PressPrimaryAction(). Lines( Contains("other_branch").IsSelected(), Contains("master"), ) // drop the commit in the 'other_branch' branch too t.Views().Commits().Focus(). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Remove). Tap(confirmCommitDrop). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Undo). Tap(confirmUndoDrop). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Undo). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Undo")). Content(Contains("Are you sure you want to checkout 'master'?")). Confirm() t.Views().Branches(). IsFocused(). Lines( Contains("master").IsSelected(), Contains("other_branch"), ) }). Focus(). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Undo). Tap(confirmUndoDrop). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Redo). Tap(confirmRedoDrop). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Redo). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Redo")). Content(Contains("Are you sure you want to checkout 'other_branch'?")). Confirm() t.Views().Branches(). IsFocused(). Lines( Contains("other_branch").IsSelected(), Contains("master"), ) }). Focus(). Press(keys.Universal.Redo). Tap(confirmRedoDrop). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/undo/undo_commit.go
pkg/integration/tests/undo/undo_commit.go
package undo import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var UndoCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Undo/redo a commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("other-file", "other-file-1") shell.Commit("one") shell.CreateFileAndAdd("file", "file-1") shell.Commit("two") shell.UpdateFile("other-file", "other-file-2") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { confirmUndo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Undo")). Content(MatchesRegexp(`Are you sure you want to soft reset to '.*'\?`)). Confirm() } confirmRedo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Redo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Confirm() } confirmDiscardFile := func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() } t.Views().Files(). Lines( Contains(" M other-file"), ) t.Views().Commits().Focus(). Lines( Contains("two").IsSelected(), Contains("one"), ). Press(keys.Universal.Undo). Tap(confirmUndo). Lines( Contains("one").IsSelected(), ) t.Views().Files(). Lines( Equals("▼ /"), Equals(" A file"), Equals(" M other-file"), ) t.Views().Commits().Focus(). Press(keys.Universal.Redo). Tap(confirmRedo). Lines( Contains("two").IsSelected(), Contains("one"), ) t.Views().Files(). Lines( Equals(" M other-file"), ) // Undo again, this time discarding the original change before redoing again t.Views().Commits().Focus(). Press(keys.Universal.Undo). Tap(confirmUndo). Lines( Contains("one").IsSelected(), ) t.Views().Files().Focus(). Lines( Equals("▼ /"), Equals(" A file"), Equals(" M other-file").IsSelected(), ). Press(keys.Universal.PrevItem). Press(keys.Universal.Remove). Tap(confirmDiscardFile). Lines( Equals(" M other-file"), ). Press(keys.Universal.Redo). Tap(confirmRedo) t.Views().Commits(). Lines( Contains("two"), Contains("one"), ) t.Views().Files(). Lines( Equals(" M other-file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/undo/undo_drop.go
pkg/integration/tests/undo/undo_drop.go
package undo import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var UndoDrop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop some commits and then undo/redo the actions", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.EmptyCommit("four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { confirmCommitDrop := func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected commit(s)?")). Confirm() } confirmUndo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Undo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Confirm() } confirmRedo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Redo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Confirm() } t.Views().Commits().Focus(). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Remove). Tap(confirmCommitDrop). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Remove). Tap(confirmCommitDrop). Lines( Contains("two").IsSelected(), Contains("one"), ). Press(keys.Universal.Undo). Tap(confirmUndo). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Undo). Tap(confirmUndo). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.Redo). Tap(confirmRedo). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). Press(keys.Universal.Redo). Tap(confirmRedo). Lines( Contains("two").IsSelected(), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/move_in_rebase.go
pkg/integration/tests/interactive_rebase/move_in_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveInRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Via a single interactive rebase move a commit all the way up then back down then slightly back up again and apply the change", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateNCommits(4) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 03"), Contains("commit 02"), Contains("--- Commits ---"), Contains("commit 01").IsSelected(), ). SelectPreviousItem(). Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 02").IsSelected(), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 01"), ). Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 02").IsSelected(), Contains("commit 04"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 01"), ). // assert we can't move past the top Press(keys.Commits.MoveUpCommit). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 02").IsSelected(), Contains("commit 04"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 02").IsSelected(), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("--- Commits ---"), Contains("commit 01"), ). // assert we can't move past the bottom Press(keys.Commits.MoveDownCommit). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("--- Commits ---"), Contains("commit 01"), ). // move it back up one so that we land in a different order than we started with Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 04"), Contains("commit 02").IsSelected(), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 01"), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("commit 04"), Contains("commit 02").IsSelected(), Contains("commit 03"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_last_commit.go
pkg/integration/tests/interactive_rebase/reword_last_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordLastCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords the last (HEAD) commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.RenameCommit). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Title(Equals("Reword commit")). InitialText(Equals("commit 02")). Clear(). Type("renamed 02"). Confirm() }). Lines( Contains("renamed 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict_and_edit.go
pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict_and_edit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SwapInRebaseWithConflictAndEdit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Via an edit-triggered rebase, swap two commits, causing a conflict, then edit the commit that will conflict.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "one") shell.Commit("commit one") shell.UpdateFileAndAdd("myfile", "two") shell.Commit("commit two") shell.UpdateFileAndAdd("myfile", "three") shell.Commit("commit three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit three").IsSelected(), Contains("commit two"), Contains("commit one"), ). NavigateToLine(Contains("commit one")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit three"), Contains("commit two"), Contains("--- Commits ---"), Contains("commit one").IsSelected(), ). NavigateToLine(Contains("commit two")). Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit two").IsSelected(), Contains("commit three"), Contains("--- Commits ---"), Contains("commit one"), ). NavigateToLine(Contains("commit three")). Press(keys.Universal.Edit). SelectPreviousItem(). Tap(func() { t.Common().ContinueRebase() }) handleConflictsFromSwap(t, "edit") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_first_commit.go
pkg/integration/tests/interactive_rebase/edit_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Edits the first commit, just to show that it's possible", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 02"), Contains("--- Commits ---"), Contains("commit 01").IsSelected(), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("commit 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_and_auto_amend.go
pkg/integration/tests/interactive_rebase/edit_and_auto_amend.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditAndAutoAmend = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Edit a commit, make a change and stage it, then continue the rebase to auto-amend the commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.Shell().CreateFile("fixup-file", "fixup content") t.Views().Files(). Focus(). Press(keys.Files.RefreshFiles). Lines( Contains("??").Contains("fixup-file").IsSelected(), ). PressPrimaryAction() t.Common().ContinueRebase() t.Views().Commits(). Focus(). Lines( Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go
pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DontShowBranchHeadsForTodoItems = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check that branch heads are shown for normal commits during interactive rebase, but not for todo items", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(2). NewBranch("branch2"). CreateNCommitsStartingAt(4, 3). NewBranch("branch3"). CreateNCommitsStartingAt(3, 7) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 09"), Contains("CI commit 08"), Contains("CI commit 07"), Contains("CI * commit 06"), Contains("CI commit 05"), Contains("CI commit 04"), Contains("CI commit 03"), Contains("CI * commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 04")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 09"), Contains("pick").Contains("CI commit 08"), Contains("pick").Contains("CI commit 07"), Contains("update-ref").Contains("branch2"), Contains("pick").Contains("CI commit 06"), // no star on this entry, even though branch2 points to it Contains("pick").Contains("CI commit 05"), Contains("--- Commits ---"), Contains("CI commit 04"), Contains("CI commit 03"), Contains("CI * commit 02"), // this star is fine though Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go
pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordYouAreHereCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords the current HEAD commit in an interactive rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { 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"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.RenameCommit). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Title(Equals("Reword commit")). InitialText(Equals("commit 02")). Clear(). Type("renamed 02"). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("renamed 02").IsSelected(), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/pick_rescheduled.go
pkg/integration/tests/interactive_rebase/pick_rescheduled.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var PickRescheduled = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Makes a pick during a rebase fail because it would overwrite an untracked file", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1\n").Commit("one") shell.UpdateFileAndAdd("file2", "2\n").Commit("two") shell.UpdateFileAndAdd("file3", "3\n").Commit("three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). NavigateToLine(Contains("one")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("three"), Contains("pick").Contains("two"), Contains("--- Commits ---"), Contains("one").IsSelected(), ). Tap(func() { t.Shell().CreateFile("file3", "other content\n") t.Common().ContinueRebase() t.ExpectPopup().Alert().Title(Equals("Error")). Content(Contains("The following untracked working tree files would be overwritten by merge"). Contains("Please move or remove them before you merge.")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("three"), Contains("--- Commits ---"), Contains("two"), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/move_across_branch_boundary_outside_rebase.go
pkg/integration/tests/interactive_rebase/move_across_branch_boundary_outside_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveAcrossBranchBoundaryOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a commit across a branch boundary in a stack of branches", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.MainBranches = []string{"master"} config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(2, 2). NewBranch("branch2"). CreateNCommitsStartingAt(2, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 05").IsSelected(), Contains("CI commit 04"), Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 04")). Press(keys.Commits.MoveDownCommit). Lines( Contains("CI commit 05"), Contains("CI * commit 03"), Contains("CI commit 04").IsSelected(), Contains("CI commit 02"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/squash_down_first_commit.go
pkg/integration/tests/interactive_rebase/squash_down_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashDownFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Tries to squash down the first commit, which results in an error message", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Commits.SquashDown). Tap(func() { t.ExpectToast(Equals("Disabled: There's no commit below to squash into")) }). Lines( Contains("commit 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict.go
pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SwapInRebaseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Via an edit-triggered rebase, swap two commits, causing a conflict. Then resolve the conflict and continue", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "one") shell.Commit("commit one") shell.UpdateFileAndAdd("myfile", "two") shell.Commit("commit two") shell.UpdateFileAndAdd("myfile", "three") shell.Commit("commit three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit three").IsSelected(), Contains("commit two"), Contains("commit one"), ). NavigateToLine(Contains("commit one")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit three"), Contains("commit two"), Contains("--- Commits ---"), Contains("commit one").IsSelected(), ). SelectPreviousItem(). Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit two").IsSelected(), Contains("commit three"), Contains("--- Commits ---"), Contains("commit one"), ). Tap(func() { t.Common().ContinueRebase() }) handleConflictsFromSwap(t, "pick") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/amend_merge.go
pkg/integration/tests/interactive_rebase/amend_merge.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ( postMergeFileContent = "post merge file content" postMergeFilename = "post-merge-file" ) var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends a staged file to a merge commit.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. NewBranch("development-branch"). CreateFileAndAdd("initial-file", "initial file content"). Commit("initial commit"). NewBranch("feature-branch"). // it's also checked out automatically CreateFileAndAdd("new-feature-file", "new content"). Commit("new feature commit"). Checkout("development-branch"). Merge("feature-branch"). CreateFileAndAdd(postMergeFilename, postMergeFileContent) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { mergeCommitMessage := "Merge branch 'feature-branch' into development-branch" t.Views().Commits(). Lines( Contains(mergeCommitMessage), Contains("new feature commit"), Contains("initial commit"), ) t.Views().Commits(). Focus(). Press(keys.Commits.AmendToCommit) t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() // assuring we haven't added a brand new commit t.Views().Commits(). Lines( Contains(mergeCommitMessage), Contains("new feature commit"), Contains("initial commit"), ) // assuring the post-merge file shows up in the merge commit. t.Views().Main(). Content(Contains(postMergeFilename)). Content(Contains("++" + postMergeFileContent)) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_the_confl_commit.go
pkg/integration/tests/interactive_rebase/edit_the_confl_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditTheConflCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Swap two commits, causing a conflict; then try to interact with the 'confl' commit, which results in an error.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "one") shell.Commit("commit one") shell.UpdateFileAndAdd("myfile", "two") shell.Commit("commit two") shell.UpdateFileAndAdd("myfile", "three") shell.Commit("commit three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit three").IsSelected(), Contains("commit two"), Contains("commit one"), ). Press(keys.Commits.MoveDownCommit). Tap(func() { t.Common().AcknowledgeConflicts() }). Focus(). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("commit two"), Contains("pick").Contains("<-- CONFLICT --- commit three"), Contains("--- Commits ---"), Contains("commit one"), ). NavigateToLine(Contains("<-- CONFLICT --- commit three")). Press(keys.Commits.RenameCommit) t.ExpectToast(Contains("Disabled: Rewording commits while interactively rebasing is not currently supported")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/fixup_second_commit.go
pkg/integration/tests/interactive_rebase/fixup_second_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Fixup the second commit into the first (initial)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateFileAndAdd("file1.txt", "File1 Content\n").Commit("First Commit"). CreateFileAndAdd("file2.txt", "Fixup Content\n").Commit("Fixup Commit Message"). CreateFileAndAdd("file3.txt", "File3 Content\n").Commit("Third Commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("Third Commit"), Contains("Fixup Commit Message"), Contains("First Commit"), ). NavigateToLine(Contains("Fixup Commit Message")). Press(keys.Commits.MarkCommitAsFixup). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Fixup")). Content(Equals("Are you sure you want to 'fixup' the selected commit(s) into the commit below?")). Confirm() }). Lines( Contains("Third Commit"), Contains("First Commit").IsSelected(), ) t.Views().Main(). // Make sure that the resulting commit message doesn't contain the // message of the fixup commit; compare this to // squash_down_second_commit.go, where it does. Content(Contains("First Commit")). Content(DoesNotContain("Fixup Commit Message")). Content(Contains("+File1 Content")). Content(Contains("+Fixup Content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/squash_down_second_commit.go
pkg/integration/tests/interactive_rebase/squash_down_second_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashDownSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Squash down the second commit into the first (initial)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Commits.SquashDown). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Squash")). Content(Equals("Are you sure you want to squash the selected commit(s) into the commit below?")). Confirm() }). Lines( Contains("commit 03"), Contains("commit 01").IsSelected(), ) t.Views().Main(). Content(Contains(" commit 01\n \n commit 02")). Content(Contains("+file01 content")). Content(Contains("+file02 content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/move.go
pkg/integration/tests/interactive_rebase/move.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Move = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Directly move a commit all the way down and all the way back up", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateNCommits(4) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("commit 03"), Contains("commit 04").IsSelected(), Contains("commit 02"), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 04").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), Contains("commit 04").IsSelected(), ). // assert nothing happens upon trying to move beyond the last commit Press(keys.Commits.MoveDownCommit). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), Contains("commit 04").IsSelected(), ). Press(keys.Commits.MoveUpCommit). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 04").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.MoveUpCommit). Lines( Contains("commit 03"), Contains("commit 04").IsSelected(), Contains("commit 02"), Contains("commit 01"), ). Press(keys.Commits.MoveUpCommit). Lines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). // assert nothing happens upon trying to move beyond the first commit Press(keys.Commits.MoveUpCommit). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). Lines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_commit_with_editor_and_fail.go
pkg/integration/tests/interactive_rebase/reword_commit_with_editor_and_fail.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordCommitWithEditorAndFail = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords a commit with editor, and fails because an empty commit message is given", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). SetConfig("core.editor", "sh -c 'echo </dev/null >.git/COMMIT_EDITMSG'") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03").IsSelected(), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Commits.RenameCommitWithEditor). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Reword in editor")). Content(Contains("Are you sure you want to reword this commit in your editor?")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("exit status 1")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_last_commit_of_stacked_branch.go
pkg/integration/tests/interactive_rebase/edit_last_commit_of_stacked_branch.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditLastCommitOfStackedBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Edit and amend the last commit of a branch in a stack of branches, and ensure that it doesn't break the stack", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.MainBranches = []string{"master"} config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(2, 2). NewBranch("branch2"). CreateNCommitsStartingAt(2, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 05").IsSelected(), Contains("CI commit 04"), Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 03")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 05"), Contains("pick").Contains("CI commit 04"), Contains("update-ref").Contains("branch1"), Contains("--- Commits ---"), Contains("CI * commit 03").IsSelected(), Contains("CI commit 02"), Contains("CI commit 01"), ) t.Shell().CreateFile("fixup-file", "fixup content") t.Views().Files(). Focus(). Press(keys.Files.RefreshFiles). Lines( Contains("??").Contains("fixup-file").IsSelected(), ). PressPrimaryAction(). Press(keys.Files.AmendLastCommit) t.ExpectPopup().Confirmation(). Title(Equals("Amend last commit")). Content(Contains("Are you sure you want to amend last commit?")). Confirm() t.Common().ContinueRebase() t.Views().Commits(). Focus(). Lines( Contains("CI commit 05"), Contains("CI commit 04"), Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/amend_fixup_commit.go
pkg/integration/tests/interactive_rebase/amend_fixup_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var AmendFixupCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends a staged file to a fixup commit, and checks that other unrelated fixup commits are not auto-squashed.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). CreateFileAndAdd("first-fixup-file", "").Commit("fixup! commit 01"). CreateNCommitsStartingAt(2, 2). CreateFileAndAdd("unrelated-fixup-file", "fixup 03").Commit("fixup! commit 03"). CreateFileAndAdd("fixup-file", "fixup 01") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("fixup! commit 03"), Contains("commit 03"), Contains("commit 02"), Contains("fixup! commit 01"), Contains("commit 01"), ). NavigateToLine(Contains("fixup! commit 01")). Press(keys.Commits.AmendToCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() }). Lines( Contains("fixup! commit 03"), Contains("commit 03"), Contains("commit 02"), Contains("fixup! commit 01").IsSelected(), Contains("commit 01"), ) t.Views().Main(). Content(Contains("fixup 01")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/delete_update_ref_todo.go
pkg/integration/tests/interactive_rebase/delete_update_ref_todo.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DeleteUpdateRefTodo = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Delete an update-ref item from the rebase todo list", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(3). NewBranch("branch2"). CreateNCommitsStartingAt(3, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 06"), Contains("pick").Contains("CI commit 05"), Contains("pick").Contains("CI commit 04"), Contains("update-ref").Contains("branch1"), Contains("pick").Contains("CI commit 03"), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI ◯ commit 01"), ). NavigateToLine(Contains("update-ref")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Contains("Are you sure you want to delete the selected update-ref todo(s)?")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 06"), Contains("pick").Contains("CI commit 05"), Contains("pick").Contains("CI commit 04"), Contains("pick").Contains("CI commit 03").IsSelected(), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI ◯ commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Remove). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("CI ◯ commit 06"), Contains("CI ◯ commit 05"), Contains("CI ◯ commit 04"), Contains("CI ◯ commit 03"), // No star on this commit, so there's no branch head here Contains("CI ◯ commit 01"), ) t.Views().Branches(). Lines( Contains("branch2"), Contains("branch1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/squash_fixups_above_first_commit.go
pkg/integration/tests/interactive_rebase/squash_fixups_above_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashFixupsAboveFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Squashes all fixups above the first (initial) commit.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2). CreateFileAndAdd("fixup-file", "fixup content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Commits.CreateFixupCommit). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Create fixup commit")). Select(Contains("fixup! commit")). Confirm() }). NavigateToLine(Contains("commit 01").DoesNotContain("fixup!")). Press(keys.Commits.SquashAboveCommits). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Apply fixup commits")). Select(Contains("Above the selected commit")). Confirm() }). Lines( Contains("commit 02"), Contains("commit 01").IsSelected(), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/quick_start.go
pkg/integration/tests/interactive_rebase/quick_start.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var QuickStart = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Quick-starts an interactive rebase in several contexts", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { // we're going to test the following: // * quick start from main fails // * quick start from feature branch starts from main // * quick start from branch with merge commit starts from merge commit shell.NewBranch("main") shell.EmptyCommit("initial commit") shell.EmptyCommit("last main commit") shell.NewBranch("feature-branch") shell.NewBranch("branch-to-merge") shell.NewBranch("branch-with-merge-commit") shell.Checkout("feature-branch") shell.EmptyCommit("feature-branch one") shell.EmptyCommit("feature-branch two") shell.Checkout("branch-to-merge") shell.EmptyCommit("branch-to-merge one") shell.EmptyCommit("branch-to-merge two") shell.Checkout("branch-with-merge-commit") shell.EmptyCommit("branch-with-merge one") shell.EmptyCommit("branch-with-merge two") shell.Merge("branch-to-merge") shell.EmptyCommit("branch-with-merge three") shell.Checkout("main") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("last main commit"), Contains("initial commit"), ). // Verify we can't quick start from main Press(keys.Commits.StartInteractiveRebase) t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Equals("Cannot start interactive rebase: the HEAD commit is a merge commit or is present on the main branch, so there is no appropriate base commit to start the rebase from. You can start an interactive rebase from a specific commit by selecting the commit and pressing `e`.")). Confirm() t.Views().Branches(). Focus(). NavigateToLine(Contains("feature-branch")). Press(keys.Universal.Select) t.Views().Commits(). Focus(). Lines( Contains("feature-branch two").IsSelected(), Contains("feature-branch one"), Contains("last main commit"), Contains("initial commit"), ). // Verify quick start picks the last commit on the main branch Press(keys.Commits.StartInteractiveRebase). Lines( Contains("--- Pending rebase todos ---"), Contains("feature-branch two").IsSelected(), Contains("feature-branch one"), Contains("--- Commits ---"), Contains("last main commit"), Contains("initial commit"), ). // Try again, verify we fail because we're already rebasing Press(keys.Commits.StartInteractiveRebase) t.ExpectToast(Equals("Disabled: Can't perform this action during a rebase")) t.Common().AbortRebase() // Verify if a merge commit is present on the branch we start from there t.Views().Branches(). Focus(). NavigateToLine(Contains("branch-with-merge-commit")). Press(keys.Universal.Select) t.Views().Commits(). Focus(). Lines( Contains("branch-with-merge three").IsSelected(), Contains("Merge branch 'branch-to-merge'"), Contains("branch-to-merge two"), Contains("branch-to-merge one"), Contains("branch-with-merge two"), Contains("branch-with-merge one"), Contains("last main commit"), Contains("initial commit"), ). Press(keys.Commits.StartInteractiveRebase). Lines( Contains("--- Pending rebase todos ---"), Contains("branch-with-merge three").IsSelected(), Contains("--- Commits ---"), Contains("Merge branch 'branch-to-merge'"), Contains("branch-to-merge two"), Contains("branch-to-merge one"), Contains("branch-with-merge two"), Contains("branch-with-merge one"), Contains("last main commit"), Contains("initial commit"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/swap_with_conflict.go
pkg/integration/tests/interactive_rebase/swap_with_conflict.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SwapWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Directly swap two commits, causing a conflict. Then resolve the conflict and continue", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "one") shell.Commit("commit one") shell.UpdateFileAndAdd("myfile", "two") shell.Commit("commit two") shell.UpdateFileAndAdd("myfile", "three") shell.Commit("commit three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit three").IsSelected(), Contains("commit two"), Contains("commit one"), ). Press(keys.Commits.MoveDownCommit) handleConflictsFromSwap(t, "pick") }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go
pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var QuickStartKeepSelectionRange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Starts an interactive rebase and checks that the same commit range stays selected", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.MainBranches = []string{"master"} config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(2, 2). NewBranch("branch2"). CreateNCommitsStartingAt(2, 4). NewBranch("branch3"). CreateNCommitsStartingAt(2, 6) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). NavigateToLine(Contains("commit 04")). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Lines( Contains("CI commit 07"), Contains("CI commit 06"), Contains("CI * commit 05"), Contains("CI commit 04").IsSelected(), Contains("CI * commit 03").IsSelected(), Contains("CI commit 02").IsSelected(), Contains("CI commit 01"), ). Press(keys.Commits.StartInteractiveRebase). Lines( Contains("--- Pending rebase todos ---"), Contains("CI commit 07"), Contains("CI commit 06"), Contains("update-ref").Contains("branch2"), Contains("CI commit 05"), Contains("CI commit 04").IsSelected(), Contains("update-ref").Contains("branch1").IsSelected(), Contains("CI commit 03").IsSelected(), Contains("CI commit 02").IsSelected(), Contains("--- Commits ---"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go
pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordYouAreHereCommitWithEditor = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords the current HEAD commit in an interactive rebase with editor", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). SetConfig("core.editor", "sh -c 'echo renamed 02 >.git/COMMIT_EDITMSG'") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03").IsSelected(), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.RenameCommitWithEditor). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Reword in editor")). Content(Contains("Are you sure you want to reword this commit in your editor?")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("renamed 02").IsSelected(), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go
pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var QuickStartKeepSelection = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Starts an interactive rebase and checks that the same commit stays selected", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.MainBranches = []string{"master"} config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(3, 2). NewBranch("branch2"). CreateNCommitsStartingAt(3, 5) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 07").IsSelected(), Contains("CI commit 06"), Contains("CI commit 05"), Contains("CI * commit 04"), Contains("CI commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Commits.StartInteractiveRebase). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 07"), Contains("pick").Contains("CI commit 06"), Contains("pick").Contains("CI commit 05"), Contains("update-ref").Contains("branch1"), Contains("pick").Contains("CI commit 04"), Contains("pick").Contains("CI commit 03"), Contains("CI commit 02").IsSelected(), Contains("--- Commits ---"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/outside_rebase_range_select.go
pkg/integration/tests/interactive_rebase/outside_rebase_range_select.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var OutsideRebaseRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Do various things with range selection in the commits view when outside rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(10) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). TopLines( Contains("commit 10").IsSelected(), ). Press(keys.Universal.RangeSelectDown). TopLines( Contains("commit 10").IsSelected(), Contains("commit 09").IsSelected(), Contains("commit 08"), ). // Drop commits Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Contains("Are you sure you want to drop the selected commit(s)?")). Confirm() }). TopLines( Contains("commit 08").IsSelected(), Contains("commit 07"), ). Press(keys.Universal.RangeSelectDown). TopLines( Contains("commit 08").IsSelected(), Contains("commit 07").IsSelected(), Contains("commit 06"), ). // Squash commits Press(keys.Commits.SquashDown). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Squash")). Content(Contains("Are you sure you want to squash the selected commit(s) into the commit below?")). Confirm() }). TopLines( Contains("commit 06").IsSelected(), Contains("commit 05"), Contains("commit 04"), ). // Verify commit messages are concatenated Tap(func() { t.Views().Main(). ContainsLines( Contains("commit 06"), AnyString(), Contains("commit 07"), AnyString(), Contains("commit 08"), ) }). // Fixup commits Press(keys.Universal.RangeSelectDown). TopLines( Contains("commit 06").IsSelected(), Contains("commit 05").IsSelected(), Contains("commit 04"), ). Press(keys.Commits.MarkCommitAsFixup). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Fixup")). Content(Contains("Are you sure you want to 'fixup' the selected commit(s) into the commit below?")). Confirm() }). TopLines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), ). // Verify commit messages are dropped Tap(func() { t.Views().Main(). Content( Contains("commit 04"). DoesNotContain("commit 06"). DoesNotContain("commit 05"), ) }). Press(keys.Universal.RangeSelectDown). TopLines( Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), Contains("commit 02"), ). // Move commits Press(keys.Commits.MoveDownCommit). TopLines( Contains("commit 02"), Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). TopLines( Contains("commit 02"), Contains("commit 01"), Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), ). Press(keys.Commits.MoveDownCommit). TopLines( Contains("commit 02"), Contains("commit 01"), Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), ). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). Press(keys.Commits.MoveUpCommit). TopLines( Contains("commit 02"), Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.MoveUpCommit). TopLines( Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), Contains("commit 02"), Contains("commit 01"), ). Press(keys.Commits.MoveUpCommit). Tap(func() { t.ExpectToast(Contains("Disabled: Cannot move any further")) }). TopLines( Contains("commit 04").IsSelected(), Contains("commit 03").IsSelected(), Contains("commit 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_range_select_outside_rebase.go
pkg/integration/tests/interactive_rebase/edit_range_select_outside_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var EditRangeSelectOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Select a range of commits to edit outside of a rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shared.CreateMergeCommit(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). TopLines( Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(), ). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Lines( Contains("CI ⏣─╮ Merge branch 'second-change-branch' into first-change-branch").IsSelected(), Contains("CI │ ◯ * second-change-branch unrelated change").IsSelected(), Contains("CI │ ◯ second change").IsSelected(), Contains("CI ◯ │ first change").IsSelected(), Contains("CI ◯─╯ * original").IsSelected(), Contains("CI ◯ three").IsSelected(), Contains("CI ◯ two"), Contains("CI ◯ one"), ). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("merge CI Merge branch 'second-change-branch' into first-change-branch").IsSelected(), Contains("edit CI first change").IsSelected(), Contains("edit CI * second-change-branch unrelated change").IsSelected(), Contains("edit CI second change").IsSelected(), Contains("edit CI * original").IsSelected(), Contains("--- Commits ---").IsSelected(), Contains(" CI ◯ three").IsSelected(), Contains(" CI ◯ two"), Contains(" CI ◯ one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/drop_merge_commit.go
pkg/integration/tests/interactive_rebase/drop_merge_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var DropMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drops a merge commit outside of an interactive rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shared.CreateMergeCommit(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI ⏣─╮ Merge branch 'second-change-branch' into first-change-branch").IsSelected(), Contains("CI │ ◯ * second-change-branch unrelated change"), Contains("CI │ ◯ second change"), Contains("CI ◯ │ first change"), Contains("CI ◯─╯ * original"), Contains("CI ◯ three"), Contains("CI ◯ two"), Contains("CI ◯ one"), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected merge commit? Note that it will also drop all the commits that were merged in by it.")). Confirm() }). Lines( Contains("CI ◯ first change").IsSelected(), Contains("CI ◯ * original"), Contains("CI ◯ three"), Contains("CI ◯ two"), Contains("CI ◯ one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go
pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var AmendCommitWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends a staged file to a commit, causing a conflict there.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file", "1\n").Commit("one") shell.UpdateFileAndAdd("file", "1\n2\n").Commit("two") shell.UpdateFileAndAdd("file", "1\n2\n3\n").Commit("three") shell.UpdateFileAndAdd("file", "1\n2\n4\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("three"), Contains("two"), Contains("one"), ). NavigateToLine(Contains("two")). Press(keys.Commits.AmendToCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() t.Common().AcknowledgeConflicts() }). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("three"), Contains("fixup").Contains("<-- CONFLICT --- fixup! two"), Contains("--- Commits ---"), Contains("two"), Contains("one"), ) t.Views().Files(). IsFocused(). Lines( Contains("UU file"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). TopLines( Contains("1"), Contains("2"), Contains("<<<<<<< HEAD"), Contains("======="), Contains("4"), Contains(">>>>>>>"), ). SelectNextItem(). PressPrimaryAction() // pick "4" t.Common().ContinueOnConflictsResolved("rebase") t.Common().AcknowledgeConflicts() t.Views().Commits(). Lines( Contains("--- Pending rebase todos ---"), Contains("<-- CONFLICT --- three"), Contains("--- Commits ---"), Contains("two"), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/drop_with_custom_comment_char.go
pkg/integration/tests/interactive_rebase/drop_with_custom_comment_char.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DropWithCustomCommentChar = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drops a commit with the 'core.commentChar' option set to a custom character", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.SetConfig("core.commentChar", ";") shell.CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Focus(). Lines( Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected commit(s)?")). Confirm() }). Lines( Contains("commit 01").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/drop_commit_in_copied_branch_with_update_ref.go
pkg/integration/tests/interactive_rebase/drop_commit_in_copied_branch_with_update_ref.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DropCommitInCopiedBranchWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drops a commit in a branch that is a copy of another branch, and verify that the other branch is left alone", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(3). NewBranch("branch2") shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI * commit 03").IsSelected(), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected commit(s)?")). Confirm() }). Lines( Contains("CI commit 03"), // no start on this commit because branch1 is no longer pointing to it Contains("CI commit 01"), ) t.Views().Branches(). Focus(). NavigateToLine(Contains("branch1")). PressPrimaryAction() t.Views().Commits().Lines( Contains("CI commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/fixup_first_commit.go
pkg/integration/tests/interactive_rebase/fixup_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var FixupFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Tries to fixup the first commit, which results in an error message", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Commits.MarkCommitAsFixup). Tap(func() { t.ExpectToast(Equals("Disabled: There's no commit below to squash into")) }). Lines( Contains("commit 02"), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/move_update_ref_todo.go
pkg/integration/tests/interactive_rebase/move_update_ref_todo.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveUpdateRefTodo = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move an update-ref item in the rebase todo list", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(3). NewBranch("branch2"). CreateNCommitsStartingAt(3, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 06"), Contains("pick").Contains("CI commit 05"), Contains("pick").Contains("CI commit 04"), Contains("update-ref").Contains("branch1"), Contains("pick").Contains("CI commit 03"), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI ◯ commit 01"), ). NavigateToLine(Contains("update-ref")). Press(keys.Commits.MoveUpCommit). Press(keys.Commits.MoveUpCommit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 06"), Contains("update-ref").Contains("branch1"), Contains("pick").Contains("CI commit 05"), Contains("pick").Contains("CI commit 04"), Contains("pick").Contains("CI commit 03"), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI ◯ commit 01"), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("CI ◯ commit 06"), Contains("CI ◯ * commit 05"), Contains("CI ◯ commit 04"), Contains("CI ◯ commit 03"), Contains("CI ◯ commit 02"), Contains("CI ◯ commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/rebase_with_commit_that_becomes_empty.go
pkg/integration/tests/interactive_rebase/rebase_with_commit_that_becomes_empty.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseWithCommitThatBecomesEmpty = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Performs a rebase involving a commit that becomes empty during the rebase, and gets dropped.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") // It is important that we create two separate commits for the two // changes to the file, but only one commit for the same changes on our // branch; otherwise, the commit would be discarded at the start of the // rebase already. shell.CreateFileAndAdd("file", "change 1\n") shell.Commit("master change 1") shell.UpdateFileAndAdd("file", "change 1\nchange 2\n") shell.Commit("master change 2") shell.NewBranchFrom("branch", "HEAD^^") shell.CreateFileAndAdd("file", "change 1\nchange 2\n") shell.Commit("branch change") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). NavigateToLine(Contains("master")). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'branch'")). Select(Contains("Simple rebase")). Confirm() t.Views().Commits(). Lines( Contains("master change 2"), Contains("master change 1"), Contains("initial commit"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/shared.go
pkg/integration/tests/interactive_rebase/shared.go
package interactive_rebase import ( . "github.com/jesseduffield/lazygit/pkg/integration/components" ) func handleConflictsFromSwap(t *TestDriver, expectedCommand string) { t.Common().AcknowledgeConflicts() t.Views().Commits(). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("commit two"), Contains(expectedCommand).Contains("<-- CONFLICT --- commit three"), Contains("--- Commits ---"), Contains("commit one"), ) t.Views().Files(). IsFocused(). Lines( Contains("UU myfile"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). TopLines( Contains("<<<<<<< HEAD"), Contains("one"), Contains("======="), Contains("three"), Contains(">>>>>>>"), ). SelectNextItem(). PressPrimaryAction() // pick "three" t.Common().ContinueOnConflictsResolved("rebase") t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). Lines( Contains("UU myfile"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). TopLines( Contains("<<<<<<< HEAD"), Contains("three"), Contains("======="), Contains("two"), Contains(">>>>>>>"), ). SelectNextItem(). PressPrimaryAction() // pick "two" t.Common().ContinueOnConflictsResolved("rebase") t.Views().Commits(). Focus(). Lines( Contains("commit two").IsSelected(), Contains("commit three"), Contains("commit one"), ). Tap(func() { t.Views().Main().Content(Contains("-three").Contains("+two")) }). SelectNextItem(). Tap(func() { t.Views().Main().Content(Contains("-one").Contains("+three")) }) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go
pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go
package interactive_rebase import ( "fmt" "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) const ( BASE_BRANCH = "base-branch" TOP_BRANCH = "top-branch" BASE_COMMIT = "base-commit" TOP_COMMIT = "top-commit" ) var AdvancedInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "It begins an interactive rebase and verifies to have the possibility of editing the commits of the branch before proceeding with the actual rebase", ExtraCmdArgs: []string{}, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. NewBranch(BASE_BRANCH). EmptyCommit(BASE_COMMIT). NewBranch(TOP_BRANCH). EmptyCommit(TOP_COMMIT) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains(TOP_COMMIT), Contains(BASE_COMMIT), ) t.Views().Branches(). Focus(). NavigateToLine(Contains(BASE_BRANCH)). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals(fmt.Sprintf("Rebase '%s'", TOP_BRANCH))). Select(Contains("Interactive rebase")). Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("--- Pending rebase todos ---"), Contains(TOP_COMMIT), Contains("--- Commits ---"), Contains(BASE_COMMIT), ). NavigateToLine(Contains(TOP_COMMIT)). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains(TOP_COMMIT).Contains("edit"), Contains("--- Commits ---"), Contains(BASE_COMMIT), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("--- Pending rebase todos ---"), Contains("--- Commits ---"), Contains(TOP_COMMIT), Contains(BASE_COMMIT), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/rebase.go
pkg/integration/tests/interactive_rebase/rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Begins an interactive rebase, then fixups, drops, and squashes some commits", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.EmptyCommit("first commit to edit") shell.EmptyCommit("commit to squash") shell.EmptyCommit("second commit to edit") shell.EmptyCommit("commit to drop") shell.CreateFileAndAdd("fixup-commit-file", "fixup-commit-file") shell.Commit("commit to fixup") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to fixup"), Contains("commit to drop"), Contains("second commit to edit"), Contains("commit to squash"), Contains("first commit to edit"), Contains("initial commit"), ). NavigateToLine(Contains("first commit to edit")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("pick.*commit to fixup"), MatchesRegexp("pick.*commit to drop"), MatchesRegexp("pick.*second commit to edit"), MatchesRegexp("pick.*commit to squash"), Contains("--- Commits ---"), Contains("first commit to edit").IsSelected(), Contains("initial commit"), ). SelectPreviousItem(). Press(keys.Commits.SquashDown). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("pick.*commit to fixup"), MatchesRegexp("pick.*commit to drop"), MatchesRegexp("pick.*second commit to edit"), MatchesRegexp("squash.*commit to squash").IsSelected(), Contains("--- Commits ---"), Contains("first commit to edit"), Contains("initial commit"), ). SelectPreviousItem(). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("pick.*commit to fixup"), MatchesRegexp("pick.*commit to drop"), MatchesRegexp("edit.*second commit to edit").IsSelected(), MatchesRegexp("squash.*commit to squash"), Contains("--- Commits ---"), Contains("first commit to edit"), Contains("initial commit"), ). SelectPreviousItem(). Press(keys.Universal.Remove). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("pick.*commit to fixup"), MatchesRegexp("drop.*commit to drop").IsSelected(), MatchesRegexp("edit.*second commit to edit"), MatchesRegexp("squash.*commit to squash"), Contains("--- Commits ---"), Contains("first commit to edit"), Contains("initial commit"), ). SelectPreviousItem(). Press(keys.Commits.MarkCommitAsFixup). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("fixup.*commit to fixup").IsSelected(), MatchesRegexp("drop.*commit to drop"), MatchesRegexp("edit.*second commit to edit"), MatchesRegexp("squash.*commit to squash"), Contains("--- Commits ---"), Contains("first commit to edit"), Contains("initial commit"), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("--- Pending rebase todos ---"), MatchesRegexp("fixup.*commit to fixup").IsSelected(), MatchesRegexp("drop.*commit to drop"), Contains("--- Commits ---"), Contains("second commit to edit"), MatchesRegexp("first commit to edit"), Contains("initial commit"), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("second commit to edit").IsSelected(), Contains("first commit to edit"), Contains("initial commit"), ). Tap(func() { // commit 4 was squashed into 6 so we assert that their messages have been concatenated t.Views().Main().Content( Contains("second commit to edit"). // file from fixup commit is present Contains("fixup-commit-file"). // but message is not (because it's a fixup, not a squash) DoesNotContain("commit to fixup"), ) }). SelectNextItem(). Tap(func() { // commit 4 was squashed into 6 so we assert that their messages have been concatenated t.Views().Main().Content( Contains("first commit to edit"). // message from squashed commit has been concatenated with message other commit Contains("commit to squash"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/move_with_custom_comment_char.go
pkg/integration/tests/interactive_rebase/move_with_custom_comment_char.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveWithCustomCommentChar = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Directly moves a commit down and back up with the 'core.commentChar' option set to a custom character", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.SetConfig("core.commentChar", ";") shell.CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Focus(). Lines( Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.MoveDownCommit). Lines( Contains("commit 01"), Contains("commit 02").IsSelected(), ). Press(keys.Commits.MoveUpCommit). Lines( Contains("commit 02").IsSelected(), Contains("commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_range_select_down_to_merge_outside_rebase.go
pkg/integration/tests/interactive_rebase/edit_range_select_down_to_merge_outside_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var EditRangeSelectDownToMergeOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Select a range of commits (the last one being a merge commit) to edit outside of a rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shared.CreateMergeCommit(shell) shell.CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). TopLines( Contains("CI ◯ commit 02").IsSelected(), Contains("CI ◯ commit 01"), Contains("Merge branch 'second-change-branch' into first-change-branch"), ). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("edit CI commit 02").IsSelected(), Contains("edit CI commit 01").IsSelected(), Contains("--- Commits ---").IsSelected(), Contains(" CI ⏣─╮ Merge branch 'second-change-branch' into first-change-branch").IsSelected(), Contains(" CI │ ◯ * second-change-branch unrelated change"), Contains(" CI │ ◯ second change"), Contains(" CI ◯ │ first change"), Contains(" CI ◯─╯ * original"), Contains(" CI ◯ three"), Contains(" CI ◯ two"), Contains(" CI ◯ one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/edit_non_todo_commit_during_rebase.go
pkg/integration/tests/interactive_rebase/edit_non_todo_commit_during_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditNonTodoCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Tries to edit a non-todo commit while already rebasing, resulting in an error message", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("--- Commits ---"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit) t.ExpectToast(Contains("Disabled: When rebasing, this action only works on a selection of TODO commits.")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go
pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ViewFilesOfTodoEntries = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check that files of a pick todo can be viewed, but files of an update-ref todo can't", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(1, 2). NewBranch("branch2"). CreateNCommitsStartingAt(1, 3) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Press(keys.Commits.StartInteractiveRebase). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI commit 03").IsSelected(), Contains("update-ref").Contains("branch1"), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI commit 01"), ). Press(keys.Universal.GoInto) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file03.txt"), ). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("update-ref")). Press(keys.Universal.GoInto) t.ExpectToast(Equals("Disabled: Selected item does not have files to view")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/interactive_rebase_of_copied_branch.go
pkg/integration/tests/interactive_rebase/interactive_rebase_of_copied_branch.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var InteractiveRebaseOfCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check that interactively rebasing a branch that is a copy of another branch doesn't affect the original branch", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(3). NewBranch("branch2") shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), // No update-ref todo for branch1 here, even though command-line git would have added it Contains("pick").Contains("CI commit 03"), Contains("pick").Contains("CI commit 02"), Contains("--- Commits ---"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/interactive_rebase_with_conflict_for_edit_command.go
pkg/integration/tests/interactive_rebase/interactive_rebase_with_conflict_for_edit_command.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var InteractiveRebaseWithConflictForEditCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase a branch interactively, and edit a commit that will conflict", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file.txt", "master content") shell.Commit("master commit") shell.NewBranchFrom("branch", "master^") shell.CreateNCommits(3) shell.CreateFileAndAdd("file.txt", "branch content") shell.Commit("this will conflict") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("this will conflict").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), Contains("initial commit"), ) t.Views().Branches(). Focus(). NavigateToLine(Contains("master")). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'branch'")). Select(Contains("Interactive rebase")). Confirm() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("this will conflict")). Press(keys.Universal.Edit) t.Common().ContinueRebase() t.ExpectPopup().Menu(). Title(Equals("Conflicts!")). Cancel() t.Views().Commits(). Lines( Contains("--- Pending rebase todos ---"), Contains("edit").Contains("<-- CONFLICT --- this will conflict").IsSelected(), Contains("--- Commits ---"), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), Contains("master commit"), Contains("initial commit"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_first_commit.go
pkg/integration/tests/interactive_rebase/reword_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) // Rewording the first commit is tricky because you can't rebase from its parent commit, // hence having a specific test for this var RewordFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords the first commit, just to show that it's possible", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Commits.RenameCommit). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Title(Equals("Reword commit")). InitialText(Equals("commit 01")). Clear(). Type("renamed 01"). Confirm() }). Lines( Contains("commit 02"), Contains("renamed 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/revert_during_rebase_when_stopped_on_edit.go
pkg/integration/tests/interactive_rebase/revert_during_rebase_when_stopped_on_edit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RevertDuringRebaseWhenStoppedOnEdit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Revert a series of commits while stopped in a rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("master commit 1") shell.EmptyCommit("master commit 2") shell.NewBranch("branch") shell.CreateNCommits(4) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 04").IsSelected(), Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), Contains("master commit 2"), Contains("master commit 1"), ). NavigateToLine(Contains("commit 03")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("commit 04"), Contains("--- Commits ---"), Contains("commit 03").IsSelected(), Contains("commit 02"), Contains("commit 01"), Contains("master commit 2"), Contains("master commit 1"), ). SelectNextItem(). Press(keys.Universal.RangeSelectDown). Press(keys.Commits.RevertCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Revert commit")). Content(MatchesRegexp(`Are you sure you want to revert \w+?`)). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("commit 04"), Contains("--- Commits ---"), Contains(`Revert "commit 01"`), Contains(`Revert "commit 02"`), Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("commit 01").IsSelected(), Contains("master commit 2"), Contains("master commit 1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/show_exec_todos.go
pkg/integration/tests/interactive_rebase/show_exec_todos.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ShowExecTodos = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Show exec todos in the rebase todo list", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) { cfg.GetUserConfig().CustomCommands = []config.CustomCommand{ { Key: "X", Context: "commits", Command: "git -c core.editor=: rebase -i -x false HEAD^^", }, } }, SetupRepo: func(shell *Shell) { shell. NewBranch("branch1"). CreateNCommits(3) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Press("X"). Tap(func() { t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Rebasing (2/4)Executing: false")).Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("exec").Contains("false"), Contains("pick").Contains("CI commit 03"), Contains("--- Commits ---"), Contains("CI ◯ commit 02"), Contains("CI ◯ commit 01"), ). Tap(func() { t.Common().ContinueRebase() t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("exit status 1")).Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("--- Commits ---"), Contains("CI ◯ commit 03"), Contains("CI ◯ commit 02"), Contains("CI ◯ commit 01"), ). Tap(func() { t.Common().ContinueRebase() }). Lines( Contains("CI ◯ commit 03"), Contains("CI ◯ commit 02"), Contains("CI ◯ commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_merge_commit.go
pkg/integration/tests/interactive_rebase/reword_merge_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords a merge commit which is not the current head commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("base"). NewBranch("first-branch"). CreateFileAndAdd("file1.txt", "content"). Commit("one"). Checkout("master"). Merge("first-branch"). NewBranch("second-branch"). EmptyCommit("two") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI ◯ two").IsSelected(), Contains("CI ⏣─╮ Merge branch 'first-branch'"), Contains("CI │ ◯ one"), Contains("CI ◯─╯ base"), ). SelectNextItem(). Press(keys.Commits.RenameCommit). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Title(Equals("Reword commit")). InitialText(Equals("Merge branch 'first-branch'")). Clear(). Type("renamed merge"). Confirm() }). Lines( Contains("CI ◯ two"), Contains("CI ⏣─╮ renamed merge").IsSelected(), Contains("CI │ ◯ one"), Contains("CI ◯ ╯ base"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/amend_first_commit.go
pkg/integration/tests/interactive_rebase/amend_first_commit.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var AmendFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends a staged file to the first (initial) commit.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(2). CreateFileAndAdd("fixup-file", "fixup content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 01")). Press(keys.Commits.AmendToCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() }). Lines( Contains("commit 02"), Contains("commit 01").IsSelected(), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/squash_fixups_above.go
pkg/integration/tests/interactive_rebase/squash_fixups_above.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashFixupsAbove = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Squashes all fixups above a commit and checks that the selected line stays correct.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). CreateFileAndAdd("fixup-file", "fixup content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Commits.CreateFixupCommit). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Create fixup commit")). Select(Contains("fixup! commit")). Confirm() }). Lines( Contains("fixup! commit 02"), Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("commit 01"), ). Press(keys.Commits.SquashAboveCommits). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Apply fixup commits")). Select(Contains("Above the selected commit")). Confirm() }). Lines( Contains("commit 03"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/revert_multiple_commits_in_interactive_rebase.go
pkg/integration/tests/interactive_rebase/revert_multiple_commits_in_interactive_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RevertMultipleCommitsInInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reverts a range of commits, the first of which conflicts, in the middle of an interactive rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "") shell.Commit("add empty file") shell.CreateFileAndAdd("otherfile", "") shell.Commit("unrelated change 1") shell.CreateFileAndAdd("myfile", "first line\n") shell.Commit("add first line") shell.UpdateFileAndAdd("myfile", "first line\nsecond line\n") shell.Commit("add second line") shell.EmptyCommit("unrelated change 2") shell.EmptyCommit("unrelated change 3") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI ◯ unrelated change 3").IsSelected(), Contains("CI ◯ unrelated change 2"), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ unrelated change 1"), Contains("CI ◯ add empty file"), ). NavigateToLine(Contains("add second line")). Press(keys.Universal.Edit). SelectNextItem(). Press(keys.Universal.RangeSelectDown). Press(keys.Commits.RevertCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Revert commit")). Content(Equals("Are you sure you want to revert the selected commits?")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Conflicts!")). Select(Contains("View conflicts")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("CI unrelated change 3"), Contains("CI unrelated change 2"), Contains("--- Pending reverts ---"), Contains("revert").Contains("CI unrelated change 1"), Contains("revert").Contains("CI <-- CONFLICT --- add first line"), Contains("--- Commits ---"), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ unrelated change 1"), Contains("CI ◯ add empty file"), ) t.Views().Options().Content(Contains("View revert options: m")) t.Views().Information().Content(Contains("Reverting (Reset)")) t.Views().Files().IsFocused(). Lines( Contains("UU myfile").IsSelected(), ). PressEnter() t.Views().MergeConflicts().IsFocused(). SelectNextItem(). PressPrimaryAction() t.ExpectPopup().Alert(). Title(Equals("Continue")). Content(Contains("All merge conflicts resolved. Continue the revert?")). Confirm() t.Views().Commits(). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI unrelated change 3"), Contains("pick").Contains("CI unrelated change 2"), Contains("--- Commits ---"), Contains(`CI ◯ Revert "unrelated change 1"`), Contains(`CI ◯ Revert "add first line"`), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ unrelated change 1"), Contains("CI ◯ add empty file"), ) t.Views().Options().Content(Contains("View rebase options: m")) t.Views().Information().Content(Contains("Rebasing (Reset)")) t.Common().ContinueRebase() t.Views().Commits(). Lines( Contains("CI ◯ unrelated change 3"), Contains("CI ◯ unrelated change 2"), Contains(`CI ◯ Revert "unrelated change 1"`), Contains(`CI ◯ Revert "add first line"`), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ unrelated change 1"), Contains("CI ◯ add empty file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/reword_last_commit_of_stacked_branch.go
pkg/integration/tests/interactive_rebase/reword_last_commit_of_stacked_branch.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RewordLastCommitOfStackedBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rewords the last commit of a branch in the middle of a stack", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.MainBranches = []string{"master"} config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(1). NewBranch("branch1"). CreateNCommitsStartingAt(2, 2). NewBranch("branch2"). CreateNCommitsStartingAt(2, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 05").IsSelected(), Contains("CI commit 04"), Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 03")). Press(keys.Commits.RenameCommit). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Title(Equals("Reword commit")). InitialText(Equals("commit 03")). Clear(). Type("renamed 03"). Confirm() }). Lines( Contains("CI commit 05"), Contains("CI commit 04"), Contains("CI * renamed 03"), Contains("CI commit 02"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/amend_head_commit_during_rebase.go
pkg/integration/tests/interactive_rebase/amend_head_commit_during_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var AmendHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends the current head commit from the commits panel during a rebase.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateNCommits(3) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 03"), Contains("commit 02"), Contains("commit 01"), ). NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.Shell().CreateFile("fixup-file", "fixup content") t.Views().Files(). Focus(). Press(keys.Files.RefreshFiles). Lines( Contains("??").Contains("fixup-file").IsSelected(), ). PressPrimaryAction() t.Views().Commits(). Focus(). Press(keys.Commits.AmendToCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() }). Lines( Contains("--- Pending rebase todos ---"), Contains("commit 03"), Contains("--- Commits ---"), Contains("commit 02").IsSelected(), Contains("commit 01"), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/squash_fixups_in_current_branch.go
pkg/integration/tests/interactive_rebase/squash_fixups_in_current_branch.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SquashFixupsInCurrentBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Squashes all fixups in the current branch.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateFileAndAdd("file1", "file1"). Commit("master commit"). NewBranch("branch"). // Test the pathological case that the first commit of a branch is a // fixup for the last master commit below it. We _don't_ want this to // be squashed. UpdateFileAndAdd("file1", "changed file1"). Commit("fixup! master commit"). CreateNCommits(2). CreateFileAndAdd("fixup-file", "fixup content"). Commit("fixup! commit 01") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). SelectNextItem(). SelectNextItem(). Lines( Contains("fixup! commit 01"), Contains("commit 02"), Contains("commit 01").IsSelected(), Contains("fixup! master commit"), Contains("master commit"), ). Press(keys.Commits.SquashAboveCommits). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Apply fixup commits")). Select(Contains("In current branch")). Confirm() }). Lines( Contains("commit 02"), Contains("commit 01").IsSelected(), Contains("fixup! master commit"), Contains("master commit"), ) t.Views().Main(). Content(Contains("fixup content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/revert_single_commit_in_interactive_rebase.go
pkg/integration/tests/interactive_rebase/revert_single_commit_in_interactive_rebase.go
package interactive_rebase import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RevertSingleCommitInInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reverts a commit that conflicts in the middle of an interactive rebase", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "") shell.Commit("add empty file") shell.CreateFileAndAdd("myfile", "first line\n") shell.Commit("add first line") shell.UpdateFileAndAdd("myfile", "first line\nsecond line\n") shell.Commit("add second line") shell.EmptyCommit("unrelated change 1") shell.EmptyCommit("unrelated change 2") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI ◯ unrelated change 2").IsSelected(), Contains("CI ◯ unrelated change 1"), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ add empty file"), ). NavigateToLine(Contains("add second line")). Press(keys.Universal.Edit). SelectNextItem(). Press(keys.Commits.RevertCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Revert commit")). Content(MatchesRegexp(`Are you sure you want to revert \w+?`)). Confirm() t.ExpectPopup().Menu(). Title(Equals("Conflicts!")). Select(Contains("View conflicts")). Cancel() // stay in commits panel }). Lines( Contains("--- Pending rebase todos ---"), Contains("CI unrelated change 2"), Contains("CI unrelated change 1"), Contains("--- Pending reverts ---"), Contains("revert").Contains("CI <-- CONFLICT --- add first line"), Contains("--- Commits ---"), Contains("CI ◯ add second line"), Contains("CI ◯ add first line").IsSelected(), Contains("CI ◯ add empty file"), ). Press(keys.Commits.MoveDownCommit). Tap(func() { t.ExpectToast(Equals("Disabled: This action is not allowed while cherry-picking or reverting")) }). Press(keys.Universal.Remove). Tap(func() { t.ExpectToast(Equals("Disabled: This action is not allowed while cherry-picking or reverting")) }) t.Views().Options().Content(Contains("View revert options: m")) t.Views().Information().Content(Contains("Reverting (Reset)")) t.Views().Files().Focus(). Lines( Contains("UU myfile").IsSelected(), ). PressEnter() t.Views().MergeConflicts().IsFocused(). SelectNextItem(). PressPrimaryAction() t.ExpectPopup().Alert(). Title(Equals("Continue")). Content(Contains("All merge conflicts resolved. Continue the revert?")). Confirm() t.Views().Commits(). Lines( Contains("--- Pending rebase todos ---"), Contains("pick").Contains("CI unrelated change 2"), Contains("pick").Contains("CI unrelated change 1"), Contains("--- Commits ---"), Contains(`CI ◯ Revert "add first line"`), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ add empty file"), ) t.Views().Options().Content(Contains("View rebase options: m")) t.Views().Information().Content(Contains("Rebasing (Reset)")) t.Common().ContinueRebase() t.Views().Commits(). Lines( Contains("CI ◯ unrelated change 2"), Contains("CI ◯ unrelated change 1"), Contains(`CI ◯ Revert "add first line"`), Contains("CI ◯ add second line"), Contains("CI ◯ add first line"), Contains("CI ◯ add empty file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false