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/interactive_rebase/drop_todo_commit_with_update_ref.go | pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go | package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file",
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.Universal.Edit).
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").DoesNotContain("*"),
Contains("pick").Contains("CI commit 04"),
Contains("pick").Contains("CI commit 03"),
Contains("--- Commits ---"),
Contains("CI commit 02").IsSelected(),
Contains("CI commit 01"),
).
Tap(func() {
t.Views().Main().Content(Contains("commit 02"))
}).
NavigateToLine(Contains("commit 06")).
Press(keys.Universal.Remove)
t.Common().ContinueRebase()
t.Views().Commits().
IsFocused().
Lines(
Contains("CI commit 07"),
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_non_head_commit_during_rebase.go | pkg/integration/tests/interactive_rebase/amend_non_head_commit_during_rebase.go | package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AmendNonHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to amend a commit that is not the head while already rebasing, resulting in an error message",
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"),
Contains("commit 01"),
)
for _, commit := range []string{"commit 01", "commit 03"} {
t.Views().Commits().
NavigateToLine(Contains(commit)).
Press(keys.Commits.AmendToCommit)
t.ExpectToast(Contains("Can't perform this action during a rebase"))
}
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/interactive_rebase/mid_rebase_range_select.go | pkg/integration/tests/interactive_rebase/mid_rebase_range_select.go | package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MidRebaseRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Do various things with range selection in the commits view when mid-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(),
).
NavigateToLine(Contains("commit 05")).
// Start a rebase
Press(keys.Universal.Edit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("pick").Contains("commit 07"),
Contains("pick").Contains("commit 06"),
Contains("--- Commits ---"),
Contains("commit 05").IsSelected(),
Contains("commit 04"),
).
SelectPreviousItem().
// perform various actions on a range of commits
Press(keys.Universal.RangeSelectUp).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("pick").Contains("commit 07").IsSelected(),
Contains("pick").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.MarkCommitAsFixup).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("fixup").Contains("commit 07").IsSelected(),
Contains("fixup").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.PickCommit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("pick").Contains("commit 07").IsSelected(),
Contains("pick").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Universal.Edit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("edit").Contains("commit 07").IsSelected(),
Contains("edit").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.SquashDown).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.MoveDownCommit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Tap(func() {
t.ExpectToast(Contains("Disabled: Cannot move any further"))
}).
Press(keys.Commits.MoveUpCommit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("pick").Contains("commit 08"),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.MoveUpCommit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit 10"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.MoveUpCommit).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
Press(keys.Commits.MoveUpCommit).
Tap(func() {
t.ExpectToast(Contains("Disabled: Cannot move any further"))
}).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("squash").Contains("commit 07").IsSelected(),
Contains("squash").Contains("commit 06").IsSelected(),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08"),
Contains("--- Commits ---"),
Contains("commit 05"),
Contains("commit 04"),
).
// Verify we can't perform an action on a range that includes both
// TODO and non-TODO commits
NavigateToLine(Contains("commit 08")).
Press(keys.Universal.RangeSelectDown).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("squash").Contains("commit 07"),
Contains("squash").Contains("commit 06"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08").IsSelected(),
Contains("--- Commits ---").IsSelected(),
Contains("commit 05").IsSelected(),
Contains("commit 04"),
).
Press(keys.Commits.MarkCommitAsFixup).
Tap(func() {
t.ExpectToast(Contains("Disabled: When rebasing, this action only works on a selection of TODO commits."))
}).
TopLines(
Contains("--- Pending rebase todos ---"),
Contains("squash").Contains("commit 07"),
Contains("squash").Contains("commit 06"),
Contains("pick").Contains("commit 10"),
Contains("pick").Contains("commit 09"),
Contains("pick").Contains("commit 08").IsSelected(),
Contains("--- Commits ---").IsSelected(),
Contains("commit 05").IsSelected(),
Contains("commit 04"),
).
// continue the rebase
Tap(func() {
t.Common().ContinueRebase()
}).
TopLines(
Contains("commit 10"),
Contains("commit 09"),
Contains("commit 08"),
Contains("commit 05"),
// selected indexes are retained, though we may want to clear it
// in future (not sure what the best behaviour is right now)
Contains("commit 04").IsSelected(),
Contains("commit 03").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go | pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits from the subcommits view, with 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().Branches().
Focus().
Lines(
Contains("first-change-branch"),
Contains("second-change-branch"),
Contains("original-branch"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
TopLines(
Contains("second-change-branch unrelated change"),
Contains("second change"),
).
Press(keys.Commits.CherryPickCopy).
Tap(func() {
t.Views().Information().Content(Contains("1 commit copied"))
}).
SelectNextItem().
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("2 commits copied"))
t.Views().Commits().
Focus().
TopLines(
Contains("first change").IsSelected(),
).
Press(keys.Commits.PasteCommits)
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
t.Common().AcknowledgeConflicts()
// cherry pick selection is not cleared when there are conflicts, so that the user
// is able to abort and try again without having to re-copy the commits
t.Views().Information().Content(Contains("2 commits copied"))
t.Views().Files().
IsFocused().
SelectedLine(Contains("file")).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
// picking 'Second change'
SelectNextItem().
PressPrimaryAction()
t.Common().ContinueOnConflictsResolved("cherry-pick")
t.Views().Files().IsEmpty()
t.Views().Commits().
Focus().
TopLines(
Contains("second-change-branch unrelated change").IsSelected(),
Contains("second change"),
Contains("first change"),
).
SelectNextItem().
Tap(func() {
// because we picked 'Second change' when resolving the conflict,
// we now see this commit as having replaced First Change with Second Change,
// as opposed to replacing 'Original' with 'Second change'
t.Views().Main().
Content(Contains("-First Change")).
Content(Contains("+Second Change"))
t.Views().Information().Content(Contains("2 commits copied"))
}).
PressEscape().
Tap(func() {
t.Views().Information().Content(DoesNotContain("commits copied"))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/cherry_pick/cherry_pick_merge.go | pkg/integration/tests/cherry_pick/cherry_pick_merge.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CherryPickMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick a merge commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "recency"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
NewBranch("first-branch").
NewBranch("second-branch").
CreateFileAndAdd("file1.txt", "content").
Commit("one").
CreateFileAndAdd("file2.txt", "content").
Commit("two").
Checkout("master").
Merge("second-branch").
Checkout("first-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("first-branch"),
Contains("master"),
Contains("second-branch"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("⏣─╮ Merge branch 'second-branch'").IsSelected(),
Contains("│ ◯ two"),
Contains("│ ◯ one"),
Contains("◯ ╯ base"),
).
// copy the merge commit
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("1 commit copied"))
t.Views().Commits().
Focus().
Lines(
Contains("base").IsSelected(),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
Confirm()
}).
Tap(func() {
t.Views().Information().Content(DoesNotContain("commit copied"))
}).
Lines(
Contains("Merge branch 'second-branch'"),
Contains("base").IsSelected(),
).
SelectPreviousItem()
t.Views().Main().ContainsLines(
Contains("Merge branch 'second-branch'"),
Contains("---"),
Contains("file1.txt | 1 +"),
Contains("file2.txt | 1 +"),
Contains("2 files changed, 2 insertions(+)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/cherry_pick/cherry_pick_range.go | pkg/integration/tests/cherry_pick/cherry_pick_range.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CherryPickRange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick range of commits from the subcommits view, without conflicts",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "recency"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
NewBranch("first-branch").
NewBranch("second-branch").
Checkout("first-branch").
EmptyCommit("one").
EmptyCommit("two").
Checkout("second-branch").
EmptyCommit("three").
EmptyCommit("four").
Checkout("first-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("first-branch"),
Contains("second-branch"),
Contains("master"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("base"),
).
// copy commits 'four' and 'three'
Press(keys.Universal.RangeSelectDown).
Lines(
Contains("four").IsSelected(),
Contains("three").IsSelected(),
Contains("base"),
).
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("2 commits copied"))
t.Views().Commits().
Focus().
Lines(
Contains("two").IsSelected(),
Contains("one"),
Contains("base"),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
}).
Tap(func() {
t.Views().Information().Content(DoesNotContain("commits copied"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two").IsSelected(),
Contains("one"),
Contains("base"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/cherry_pick/cherry_pick_during_rebase.go | pkg/integration/tests/cherry_pick/cherry_pick_during_rebase.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CherryPickDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits from the subcommits view during a rebase",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.Log.ShowGraph = "never"
config.GetUserConfig().Git.LocalBranchSortOrder = "recency"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
NewBranch("first-branch").
NewBranch("second-branch").
Checkout("first-branch").
EmptyCommit("one").
EmptyCommit("two").
Checkout("second-branch").
EmptyCommit("three").
EmptyCommit("four").
Checkout("first-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("first-branch"),
Contains("second-branch"),
Contains("master"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("base"),
).
// copy commit 'three'
SelectNextItem().
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("1 commit copied"))
t.Views().Commits().
Focus().
Lines(
Contains("CI two").IsSelected(),
Contains("CI one"),
Contains("CI base"),
).
SelectNextItem().
Press(keys.Universal.Edit).
Lines(
Contains("--- Pending rebase todos ---"),
Contains("pick CI two"),
Contains("--- Commits ---"),
Contains(" CI one").IsSelected(),
Contains(" CI base"),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
Confirm()
}).
Tap(func() {
t.Views().Information().Content(DoesNotContain("commit copied"))
}).
Lines(
Contains("--- Pending rebase todos ---"),
Contains("pick CI two"),
Contains("--- Commits ---"),
Contains(" CI three"),
Contains(" CI one").IsSelected(),
Contains(" CI base"),
).
Tap(func() {
t.Common().ContinueRebase()
}).
Lines(
Contains("CI two"),
Contains("CI three"),
Contains("CI one").IsSelected(),
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/cherry_pick/cherry_pick.go | pkg/integration/tests/cherry_pick/cherry_pick.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits from the subcommits view, without conflicts",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "recency"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
NewBranch("first-branch").
NewBranch("second-branch").
Checkout("first-branch").
EmptyCommit("one").
EmptyCommit("two").
Checkout("second-branch").
EmptyCommit("three").
EmptyCommit("four").
Checkout("first-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("first-branch"),
Contains("second-branch"),
Contains("master"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("base"),
).
// copy commits 'four' and 'three'
Press(keys.Commits.CherryPickCopy).
Tap(func() {
t.Views().Information().Content(Contains("1 commit copied"))
}).
SelectNextItem().
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("2 commits copied"))
t.Views().Commits().
Focus().
Lines(
Contains("two").IsSelected(),
Contains("one"),
Contains("base"),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
// cherry-picked commits will be deleted after confirmation
t.Views().Information().Content(Contains("2 commits copied"))
}).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
}).
Tap(func() {
t.Views().Information().Content(DoesNotContain("commits copied"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two").IsSelected(),
Contains("one"),
Contains("base"),
)
// Even though the cherry-picking mode has been reset, it's still possible to paste the copied commits again:
t.Views().Branches().
Focus().
NavigateToLine(Contains("master")).
PressPrimaryAction()
t.Views().Commits().
Focus().
Lines(
Contains("base").IsSelected(),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
}).
Tap(func() {
t.Views().Information().Content(DoesNotContain("commits copied"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("base").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/cherry_pick/cherry_pick_commit_that_becomes_empty.go | pkg/integration/tests/cherry_pick/cherry_pick_commit_that_becomes_empty.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CherryPickCommitThatBecomesEmpty = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry-pick a commit that becomes empty at the destination",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
CreateFileAndAdd("file1", "change 1\n").
CreateFileAndAdd("file2", "change 2\n").
Commit("two changes in one commit").
NewBranchFrom("branch", "HEAD^").
CreateFileAndAdd("file1", "change 1\n").
Commit("single change").
CreateFileAndAdd("file3", "change 3\n").
Commit("unrelated change").
Checkout("master")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("master").IsSelected(),
Contains("branch"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains("unrelated change").IsSelected(),
Contains("single change"),
Contains("base"),
).
Press(keys.Universal.RangeSelectDown).
Press(keys.Commits.CherryPickCopy).
Tap(func() {
t.Views().Information().Content(Contains("2 commits copied"))
})
t.Views().Commits().
Focus().
Lines(
Contains("two changes in one commit").IsSelected(),
Contains("base"),
).
Press(keys.Commits.PasteCommits).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
})
if t.Git().Version().IsAtLeast(2, 45, 0) {
t.Views().Commits().
Lines(
Contains("unrelated change"),
Contains("single change"),
Contains("two changes in one commit").IsSelected(),
Contains("base"),
).
SelectPreviousItem()
// Cherry-picked commit is empty
t.Views().Main().Content(DoesNotContain("diff --git"))
} else {
t.Views().Commits().
// We have a bug with how the selection is updated in this case; normally you would
// expect the "two changes in one commit" commit to be selected because it was
// selected before pasting, and we try to maintain that selection. This is broken
// for two reasons:
// 1. We increment the selected line index after pasting by the number of pasted
// commits; this is wrong because we skipped the commit that became empty. So
// according to this bug, the "base" commit should be selected.
// 2. We only update the selected line index after pasting if the currently selected
// commit is not a rebase TODO commit, on the assumption that if it is, we are in a
// rebase and the cherry-picked commits end up below the selection. In this case,
// however, we still think we are cherry-picking because the final refresh after the
// CheckMergeOrRebase in CherryPickHelper.Paste is async and hasn't completed yet;
// so the "unrelated change" still has a "pick" action.
//
// Since this only happens for older git versions, we don't bother fixing it.
Lines(
Contains("unrelated change").IsSelected(),
Contains("two changes in one 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/cherry_pick/cherry_pick_conflicts_empty_commit_after_resolving.go | pkg/integration/tests/cherry_pick/cherry_pick_conflicts_empty_commit_after_resolving.go | package cherry_pick
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var CherryPickConflictsEmptyCommitAfterResolving = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits with conflicts, resolve them so that the commit becomes empty",
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().Branches().
Focus().
Lines(
Contains("first-change-branch"),
Contains("second-change-branch"),
Contains("original-branch"),
).
SelectNextItem().
PressEnter()
t.Views().SubCommits().
IsFocused().
TopLines(
Contains("second-change-branch unrelated change"),
Contains("second change"),
).
Press(keys.Universal.RangeSelectDown).
Press(keys.Commits.CherryPickCopy)
t.Views().Information().Content(Contains("2 commits copied"))
t.Views().Commits().
Focus().
TopLines(
Contains("first change").IsSelected(),
).
Press(keys.Commits.PasteCommits)
t.ExpectPopup().Alert().
Title(Equals("Cherry-pick")).
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
Confirm()
t.Common().AcknowledgeConflicts()
t.Views().Files().
IsFocused().
SelectedLine(Contains("file")).
Press(keys.Universal.Remove)
t.ExpectPopup().Menu().
Title(Equals("Discard changes")).
Select(Contains("Discard all changes")).
Confirm()
t.Common().ContinueOnConflictsResolved("cherry-pick")
t.Views().Files().IsEmpty()
t.Views().Commits().
Focus().
TopLines(
// We have a bug with how the selection is updated in this case; normally you would
// expect the "first change" commit to be selected because it was selected before
// pasting, and we try to maintain that selection. This is broken for two reasons:
// 1. We increment the selected line index after pasting by the number of pasted
// commits; this is wrong because we skipped the commit that became empty. So
// according to this bug, the "original" commit should be selected.
// 2. We only update the selected line index after pasting if the currently selected
// commit is not a rebase TODO commit, on the assumption that if it is, we are in a
// rebase and the cherry-picked commits end up below the selection. In this case,
// however, we still think we are cherry-picking because the final refresh after the
// CheckMergeOrRebase in CherryPickHelper.Paste is async and hasn't completed yet;
// so the "second-change-branch unrelated change" still has a "pick" action.
//
// We don't bother fixing it for now because it's a pretty niche case, and the
// nature of the problem is only cosmetic.
Contains("second-change-branch unrelated change").IsSelected(),
Contains("first 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/staging/stage_lines.go | pkg/integration/tests/staging/stage_lines.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StageLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various lines of a file in the staging panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\ntwo\n")
shell.Commit("one")
shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEnter()
t.Views().Staging().
IsFocused().
SelectedLines(Contains("+three")).
// stage 'three'
PressPrimaryAction().
// 'three' moves over to the staging secondary panel
Content(DoesNotContain("+three")).
Tap(func() {
t.Views().StagingSecondary().
ContainsLines(
Contains("+three"),
)
}).
SelectedLines(Contains("+four")).
// stage 'four'
PressPrimaryAction().
// nothing left in our staging panel
IsEmpty()
// because we've staged everything we get moved to the staging secondary panel
// do the same thing as above, moving the lines back to the staging panel
t.Views().StagingSecondary().
IsFocused().
ContainsLines(
Contains("+three"),
Contains("+four"),
).
SelectedLines(Contains("+three")).
PressPrimaryAction().
Content(DoesNotContain("+three")).
Tap(func() {
t.Views().Staging().
ContainsLines(
Contains("+three"),
)
}).
SelectedLines(Contains("+four")).
// pressing 'remove' has the same effect as pressing space when in the staging secondary panel
Press(keys.Universal.Remove).
IsEmpty()
// stage one line and then manually toggle to the staging secondary panel
t.Views().Staging().
IsFocused().
ContainsLines(
Contains("+three"),
Contains("+four"),
).
SelectedLines(Contains("+three")).
PressPrimaryAction().
Content(DoesNotContain("+three")).
Tap(func() {
t.Views().StagingSecondary().
Content(Contains("+three"))
}).
Press(keys.Universal.TogglePanel)
// manually toggle back to the staging panel
t.Views().StagingSecondary().
IsFocused().
Press(keys.Universal.TogglePanel)
t.Views().Staging().
SelectedLines(Contains("+four")).
// discard the line
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Discard change")).
Content(Contains("Are you sure you want to discard this change")).
Confirm()
}).
IsEmpty()
t.Views().StagingSecondary().
IsFocused().
ContainsLines(
Contains("+three"),
).
// return to file
PressEscape()
t.Views().Files().
IsFocused().
Lines(
Contains("M file1").IsSelected(),
).
PressEnter()
// because we only have a staged change we'll land in the staging secondary panel
t.Views().StagingSecondary().
IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/diff_change_screen_mode.go | pkg/integration/tests/staging/diff_change_screen_mode.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiffChangeScreenMode = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Change the staged changes screen mode",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("file", "first line\nsecond line")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
PressEnter()
t.Views().Staging().
IsFocused().
PressPrimaryAction().
Title(Equals("Unstaged changes")).
Content(Contains("+second line").DoesNotContain("+first line")).
PressTab()
t.Views().StagingSecondary().
IsFocused().
Title(Equals("Staged changes")).
Content(Contains("+first line").DoesNotContain("+second line")).
Press(keys.Universal.NextScreenMode).
Tap(func() {
t.Views().AppStatus().
IsInvisible()
t.Views().Staging().
IsVisible()
}).
Press(keys.Universal.NextScreenMode).
Tap(func() {
t.Views().AppStatus().
IsInvisible()
t.Views().Staging().
IsInvisible()
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/diff_context_change.go | pkg/integration/tests/staging/diff_context_change.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Change the number of diff context lines while in the staging panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// need to be working with a few lines so that git perceives it as two separate hunks
shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a")
shell.Commit("one")
shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a")
// hunk looks like:
// diff --git a/file1 b/file1
// index 3653080..a6388b6 100644
// --- a/file1
// +++ b/file1
// @@ -1,6 +1,6 @@
// 1a
// 2a
// -3a
// +3b
// 4a
// 5a
// 6a
// @@ -10,6 +10,6 @@
// 10a
// 11a
// 12a
// -13a
// +13b
// 14a
// 15a
// \ No newline at end of file
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEnter()
t.Views().Staging().
IsFocused().
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.IncreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 4"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.DecreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 3"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.DecreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 2"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.DecreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 1"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
PressPrimaryAction().
Press(keys.Universal.TogglePanel)
t.Views().StagingSecondary().
IsFocused().
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.DecreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 0"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.IncreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 1"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.IncreaseContextInDiffView).
Tap(func() {
t.ExpectToast(Equals("Changed diff context size to 2"))
}).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/discard_all_changes.go | pkg/integration/tests/staging/discard_all_changes.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discard all changes of a file in the staging panel, then assert we land in the staging panel of the next file",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\ntwo\n")
shell.CreateFileAndAdd("file2", "1\n2\n")
shell.Commit("one")
shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n")
shell.UpdateFile("file2", "1\n2\n3\n4\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" M file1"),
Equals(" M file2"),
).
SelectNextItem().
PressEnter()
t.Views().Staging().
IsFocused().
Press(keys.Main.ToggleSelectHunk).
SelectedLines(Contains("+three")).
// discard the line
Press(keys.Universal.Remove).
Tap(func() {
t.Common().ConfirmDiscardLines()
}).
SelectedLines(Contains("+four")).
// discard the other line
Press(keys.Universal.Remove).
Tap(func() {
t.Common().ConfirmDiscardLines()
// because there are no more changes in file1 we switch to file2
t.Views().Files().
Lines(
Equals(" M file2"),
)
}).
// assert we are still in the staging panel, but now looking at the changes of the other file
IsFocused().
SelectedLines(Contains("+3"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/search.go | pkg/integration/tests/staging/search.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Search = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Use the search feature in the staging panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("file1", "one\ntwo\nthree\nfour\nfive")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEnter()
t.Views().Staging().
IsFocused().
Press(keys.Universal.StartSearch).
Tap(func() {
t.ExpectSearch().
Type("four").
Confirm()
t.Views().Search().IsVisible().Content(Contains("matches for 'four' (1 of 1)"))
}).
SelectedLine(Contains("+four")). // stage the line
PressPrimaryAction().
Content(DoesNotContain("+four")).
Tap(func() {
t.Views().StagingSecondary().
Content(Contains("+four"))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/stage_hunks.go | pkg/integration/tests/staging/stage_hunks.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various hunks of a file in the staging panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a")
shell.Commit("one")
shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6b\n7a\n8a")
// hunk looks like:
// diff --git a/file1 b/file1
// index 3653080..a6388b6 100644
// --- a/file1
// +++ b/file1
// @@ -1,6 +1,6 @@
// 1a
// 2a
// -3a
// +3b
// 4a
// 5a
// -6a
// +6b
// 7a
// 8a
// \ No newline at end of file
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEnter()
t.Views().Staging().
IsFocused().
SelectedLines(
Contains("-3a"),
).
Press(keys.Universal.NextBlock).
SelectedLines(
Contains("-6a"),
).
Press(keys.Main.ToggleSelectHunk).
SelectedLines(
Contains("-6a"),
Contains("+6b"),
).
// when in hunk mode, pressing up/down moves us up/down by a hunk
SelectPreviousItem().
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
SelectNextItem().
SelectedLines(
Contains("-6a"),
Contains("+6b"),
).
// stage the second hunk
PressPrimaryAction().
ContainsLines(
Contains("-3a"),
Contains("+3b"),
).
Tap(func() {
t.Views().StagingSecondary().
ContainsLines(
Contains("-6a"),
Contains("+6b"),
)
}).
Press(keys.Universal.TogglePanel)
t.Views().StagingSecondary().
IsFocused().
// after toggling panel, we're back to only having selected a single line
SelectedLines(
Contains("-6a"),
).
PressPrimaryAction().
SelectedLines(
Contains("+6b"),
).
PressPrimaryAction().
IsEmpty()
t.Views().Staging().
IsFocused().
SelectedLines(
Contains("-3a"),
).
Press(keys.Main.ToggleSelectHunk).
SelectedLines(
Contains(`-3a`),
Contains(`+3b`),
).
Press(keys.Universal.Remove).
Tap(func() {
t.Common().ConfirmDiscardLines()
}).
Content(DoesNotContain("-3a").DoesNotContain("+3b")).
SelectedLines(
Contains("-6a"),
Contains("+6b"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/staging/stage_ranges.go | pkg/integration/tests/staging/stage_ranges.go | package staging
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various ranges of a file in the staging panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\ntwo\n")
shell.Commit("one")
shell.UpdateFile("file1", "one\ntwo\nthree\nfour\nfive\nsix\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEnter()
t.Views().Staging().
IsFocused().
SelectedLines(
Contains("+three"),
).
Press(keys.Universal.ToggleRangeSelect).
NavigateToLine(Contains("+five")).
SelectedLines(
Contains("+three"),
Contains("+four"),
Contains("+five"),
).
// stage the three lines we've just selected
PressPrimaryAction().
SelectedLines(
Contains("+six"),
).
ContainsLines(
Contains(" five"),
Contains("+six"),
).
Tap(func() {
t.Views().StagingSecondary().
ContainsLines(
Contains("+three"),
Contains("+four"),
Contains("+five"),
)
}).
Press(keys.Universal.TogglePanel)
t.Views().StagingSecondary().
IsFocused().
SelectedLines(
Contains("+three"),
).
Press(keys.Universal.ToggleRangeSelect).
NavigateToLine(Contains("+five")).
SelectedLines(
Contains("+three"),
Contains("+four"),
Contains("+five"),
).
// unstage the three selected lines
PressPrimaryAction().
// nothing left in our staging secondary panel
IsEmpty().
Tap(func() {
t.Views().Staging().
ContainsLines(
Contains("+three"),
Contains("+four"),
Contains("+five"),
Contains("+six"),
)
})
t.Views().Staging().
IsFocused().
// coincidentally we land at '+four' here. Maybe we should instead land
// at '+three'? given it's at the start of the hunk?
SelectedLines(
Contains("+four"),
).
Press(keys.Universal.ToggleRangeSelect).
SelectNextItem().
SelectedLines(
Contains("+four"),
Contains("+five"),
).
Press(keys.Universal.Remove).
Tap(func() {
t.Common().ConfirmDiscardLines()
}).
ContainsLines(
Contains("+three"),
Contains("+six"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/ignore_whitespace.go | pkg/integration/tests/diff/ignore_whitespace.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var (
initialFileContent = "first-line\nold-second-line\nthird-line\n"
// We're indenting each line and modifying the second line
updatedFileContent = " first-line\n new-second-line\n third-line\n"
)
var IgnoreWhitespace = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Toggle whitespace in the diff",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", initialFileContent)
shell.Commit("initial commit")
shell.UpdateFile("myfile", updatedFileContent)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Main().ContainsLines(
Contains(`-first-line`),
Contains(`-old-second-line`),
Contains(`-third-line`),
Contains(`+ first-line`),
Contains(`+ new-second-line`),
Contains(`+ third-line`),
)
t.Views().Files().
IsFocused().
Press(keys.Universal.ToggleWhitespaceInDiffView)
// lines with only whitespace changes are ignored (first and third lines)
t.Views().Main().ContainsLines(
Contains(` first-line`),
Contains(`-old-second-line`),
Contains(`+ new-second-line`),
Contains(` third-line`),
)
// when toggling again it goes back to showing whitespace
t.Views().Files().
IsFocused().
Press(keys.Universal.ToggleWhitespaceInDiffView)
t.Views().Main().ContainsLines(
Contains(`-first-line`),
Contains(`-old-second-line`),
Contains(`-third-line`),
Contains(`+ first-line`),
Contains(`+ new-second-line`),
Contains(`+ third-line`),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/diff_commits.go | pkg/integration/tests/diff/diff_commits.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View the diff between two commits",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "first line\n")
shell.Commit("first commit")
shell.UpdateFileAndAdd("file1", "first line\nsecond line\n")
shell.Commit("second commit")
shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n")
shell.Commit("third commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("third commit").IsSelected(),
Contains("second commit"),
Contains("first commit"),
).
Press(keys.Universal.DiffingMenu).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(MatchesRegexp(`Diff \w+`)).Confirm()
t.Views().Information().Content(Contains("Showing output for: git diff"))
}).
SelectNextItem().
SelectNextItem().
SelectedLine(Contains("first commit")).
Tap(func() {
t.Views().Main().Content(Contains("-second line\n-third line"))
}).
Press(keys.Universal.DiffingMenu).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Reverse diff direction")).Confirm()
t.Views().Main().Content(Contains("+second line\n+third line"))
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
SelectedLine(Contains("file1"))
t.Views().Main().Content(Contains("+second line\n+third line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/diff_and_apply_patch.go | pkg/integration/tests/diff/diff_and_apply_patch.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a patch from the diff between two branches and apply the patch.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-a")
shell.CreateFileAndAdd("file1", "first line\n")
shell.Commit("first commit")
shell.NewBranch("branch-b")
shell.UpdateFileAndAdd("file1", "first line\nsecond line\n")
shell.Commit("update")
shell.Checkout("branch-a")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("branch-a"),
Contains("branch-b"),
).
Press(keys.Universal.DiffingMenu)
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Equals("Diff branch-a")).Confirm()
t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-a"))
t.Views().Branches().
IsFocused().
SelectNextItem().
Tap(func() {
t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b"))
t.Views().Main().Content(Contains("+second line"))
}).
PressEnter()
t.Views().SubCommits().
IsFocused().
SelectedLine(Contains("update")).
Tap(func() {
t.Views().Main().Content(Contains("+second line"))
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
SelectedLine(Contains("file1")).
Tap(func() {
t.Views().Main().Content(Contains("+second line"))
}).
PressPrimaryAction(). // add the file to the patch
Press(keys.Universal.DiffingMenu).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Exit diff mode")).Confirm()
t.Views().Information().Content(Contains("Building patch"))
}).
Press(keys.Universal.CreatePatchOptionsMenu)
// adding the regex '$' here to distinguish the menu item from the 'Apply patch in reverse' item
t.ExpectPopup().Menu().Title(Equals("Patch options")).Select(MatchesRegexp("Apply patch$")).Confirm()
t.Views().Files().
Focus().
SelectedLine(Contains("file1"))
t.Views().Main().Content(Contains("+second line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/diff_non_sticky_range.go | pkg/integration/tests/diff/diff_non_sticky_range.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiffNonStickyRange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View the combined diff of multiple commits using a range selection",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CreateFileAndAdd("file1", "first line\n")
shell.Commit("first commit")
shell.UpdateFileAndAdd("file1", "first line\nsecond line\n")
shell.Commit("second commit")
shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n")
shell.Commit("third commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("third commit").IsSelected(),
Contains("second commit"),
Contains("first commit"),
Contains("initial commit"),
).
Press(keys.Universal.RangeSelectDown).
Press(keys.Universal.RangeSelectDown).
Tap(func() {
t.Views().Main().Content(Contains("Showing diff for range ").
Contains("+first line\n+second line\n+third line"))
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
SelectedLine(Contains("file1"))
t.Views().Main().Content(Contains("+first line\n+second line\n+third line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/diff.go | pkg/integration/tests/diff/diff.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Diff = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View the diff of two branches, then view the reverse diff",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-a")
shell.CreateFileAndAdd("file1", "first line")
shell.Commit("first commit")
shell.NewBranch("branch-b")
shell.UpdateFileAndAdd("file1", "first line\nsecond line")
shell.Commit("update")
shell.Checkout("branch-a")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
TopLines(
Contains("branch-a"),
Contains("branch-b"),
).
Press(keys.Universal.DiffingMenu)
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains(`Diff branch-a`)).Confirm()
t.Views().Branches().
IsFocused().
Tap(func() {
t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-a"))
}).
SelectNextItem().
Tap(func() {
t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b"))
t.Views().Main().Content(Contains("+second line"))
}).
PressEnter()
t.Views().SubCommits().
IsFocused().
SelectedLine(Contains("update")).
Tap(func() {
t.Views().Main().Content(Contains("+second line"))
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
SelectedLine(Contains("file1")).
Tap(func() {
t.Views().Main().Content(Contains("+second line"))
}).
PressEscape()
t.Views().SubCommits().PressEscape()
t.Views().Branches().
IsFocused().
Press(keys.Universal.DiffingMenu)
t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Reverse diff direction")).Confirm()
t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b -R"))
t.Views().Main().Content(Contains("-second line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/copy_to_clipboard.go | pkg/integration/tests/diff/copy_to_clipboard.go | package diff
import (
"os"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// note: this is required to simulate the clipboard during CI
func expectClipboard(t *TestDriver, matcher *TextMatcher) {
defer t.Shell().DeleteFile("clipboard")
t.FileSystem().FileContent("clipboard", matcher)
}
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "The copy menu allows to copy name and diff of selected/all files",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.CreateDir("dir")
shell.CreateFileAndAdd("dir/file1", "1st line\n")
shell.Commit("1")
shell.UpdateFileAndAdd("dir/file1", "1st line\n2nd line\n")
shell.CreateFileAndAdd("dir/file2", "file2\n")
shell.Commit("2")
shell.UpdateFileAndAdd("dir/file1", "1st line\n2nd line\n3rd line\n")
shell.Commit("3")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("3").IsSelected(),
Contains("2"),
Contains("1"),
).
SelectNextItem().
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("dir").IsSelected(),
Contains("file1"),
Contains("file2"),
).
NavigateToLine(Contains("file1")).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("File name")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File name copied to clipboard"))
expectClipboard(t, Equals("file1"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Relative path")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File path copied to clipboard"))
expectClipboard(t, Equals("dir/file1"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Absolute path")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File path copied to clipboard"))
repoDir, _ := os.Getwd()
// On windows the following path would have backslashes, but we don't run integration tests on windows yet.
expectClipboard(t, Equals(repoDir+"/dir/file1"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Diff of selected file")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File diff copied to clipboard"))
expectClipboard(t,
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+2nd line").DoesNotContain("+1st line").
DoesNotContain("diff --git a/dir/file2 b/dir/file2").DoesNotContain("+file2"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Diff of all files")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("All files diff copied to clipboard"))
expectClipboard(t,
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+2nd line").DoesNotContain("+1st line").
Contains("diff --git a/dir/file2 b/dir/file2").Contains("+file2"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Content of selected file")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File content copied to clipboard"))
expectClipboard(t, Equals("1st line\n2nd line\n"))
})
})
t.Views().Commits().
Focus().
// Select commits 1 and 2
Press(keys.Universal.RangeSelectDown).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("dir").IsSelected(),
Contains("file1"),
Contains("file2"),
).
NavigateToLine(Contains("file1")).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Diff of selected file")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File diff copied to clipboard"))
expectClipboard(t,
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+1st line").Contains("+2nd line"))
})
}).
Press(keys.Files.CopyFileInfoToClipboard).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Content of selected file")).
Confirm().
Tap(func() {
t.ExpectToast(Equals("File content copied to clipboard"))
expectClipboard(t, Equals("1st line\n2nd line\n"))
})
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/diff/rename_similarity_threshold_change.go | pkg/integration/tests/diff/rename_similarity_threshold_change.go | package diff
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Change the rename similarity threshold while in the commits panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n")
shell.Commit("add original")
shell.DeleteFileAndAdd("original")
shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n")
shell.Commit("change name and contents")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus()
t.Views().Main().
ContainsLines(
Contains("2 files changed, 10 insertions(+), 5 deletions(-)"),
)
t.Views().Commits().
Press(keys.Universal.DecreaseRenameSimilarityThreshold).
Tap(func() {
t.ExpectToast(Equals("Changed rename similarity threshold to 45%"))
})
t.Views().Main().
ContainsLines(
Contains("original => renamed"),
Contains("1 file changed, 5 insertions(+)"),
)
t.Views().Commits().
Press(keys.Universal.FocusMainView)
t.Views().Main().
Press(keys.Universal.IncreaseRenameSimilarityThreshold).
Tap(func() {
t.ExpectToast(Equals("Changed rename similarity threshold to 50%"))
}).
ContainsLines(
Contains("2 files changed, 10 insertions(+), 5 deletions(-)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/drop_commit_in_filtering_mode.go | pkg/integration/tests/filter_by_path/drop_commit_in_filtering_mode.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DropCommitInFilteringMode = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, then drop a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
filterByFilterFile(t, keys)
t.Views().Commits().
IsFocused().
Lines(
Contains(`both files`).IsSelected(),
Contains(`only filterFile`),
).
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(`only filterFile`).IsSelected(),
).
Press(keys.Universal.Return).
Lines(
Contains(`none of the two`),
Contains(`only otherFile`),
Contains(`only filterFile`).IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/select_filtered_file_when_entering_commit_no_root_item.go | pkg/integration/tests/filter_by_path/select_filtered_file_when_entering_commit_no_root_item.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectFilteredFileWhenEnteringCommitNoRootItem = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, then enter a commit and ensure the file is selected (with the show root item config off)",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.ShowRootItemInFileTree = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "")
shell.CreateFileAndAdd("dir/file2", "")
shell.Commit("add files")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter path to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter path:")).
Type("dir/file2").
Confirm()
t.Views().Commits().
Focus().
Lines(
Contains("add files").IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ dir"),
Equals(" A file2").IsSelected(),
Equals("A file1"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/reword_commit_in_filtering_mode.go | pkg/integration/tests/filter_by_path/reword_commit_in_filtering_mode.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RewordCommitInFilteringMode = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, then reword a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
filterByFilterFile(t, keys)
t.Views().Commits().
IsFocused().
Lines(
Contains(`both files`).IsSelected(),
Contains(`only filterFile`),
).
SelectNextItem().
Press(keys.Commits.RenameCommit).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Clear().
Type("new message").
Confirm()
}).
Lines(
Contains(`both files`),
Contains(`new message`).IsSelected(),
).
Press(keys.Universal.Return).
Lines(
Contains(`none of the two`),
Contains(`both files`),
Contains(`only otherFile`),
Contains(`new message`).IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/keep_same_commit_selected_on_exit.go | pkg/integration/tests/filter_by_path/keep_same_commit_selected_on_exit.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var KeepSameCommitSelectedOnExit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "When exiting filtering mode, keep the same commit selected if possible",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
filterByFilterFile(t, keys)
t.Views().Commits().
IsFocused().
Lines(
Contains(`both files`).IsSelected(),
Contains(`only filterFile`),
).
Tap(func() {
t.Views().Main().
ContainsLines(
Equals(" both files"),
Equals("---"),
Equals(" filterFile | 2 +-"),
Equals(" 1 file changed, 1 insertion(+), 1 deletion(-)"),
)
}).
PressEscape().
Lines(
Contains(`none of the two`),
Contains(`both files`).IsSelected(),
Contains(`only otherFile`),
Contains(`only filterFile`),
)
t.Views().Main().
ContainsLines(
Equals(" both files"),
Equals("---"),
Equals(" filterFile | 2 +-"),
Equals(" otherFile | 2 +-"),
Equals(" 2 files changed, 2 insertions(+), 2 deletions(-)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/cli_arg.go | pkg/integration/tests/filter_by_path/cli_arg.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CliArg = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, using CLI arg",
ExtraCmdArgs: []string{"-f=filterFile"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
postFilterTest(t)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/select_file.go | pkg/integration/tests/filter_by_path/select_file.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectFile = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, by finding file in UI and filtering on it",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains(`none of the two`).IsSelected(),
Contains(`both files`),
Contains(`only otherFile`),
Contains(`only filterFile`),
).
NavigateToLine(Contains(`both files`)).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals(`▼ /`).IsSelected(),
Equals(` M filterFile`),
Equals(` M otherFile`),
).
SelectNextItem().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().Title(Equals("Filtering")).
Select(Contains("Filter by 'filterFile'")).Confirm()
postFilterTest(t)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/shared.go | pkg/integration/tests/filter_by_path/shared.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
func commonSetup(shell *Shell) {
shell.CreateFileAndAdd("filterFile", "original filterFile content")
shell.Commit("only filterFile")
shell.CreateFileAndAdd("otherFile", "original otherFile content")
shell.Commit("only otherFile")
shell.UpdateFileAndAdd("otherFile", "new otherFile content")
shell.UpdateFileAndAdd("filterFile", "new filterFile content")
shell.Commit("both files")
shell.EmptyCommit("none of the two")
}
func filterByFilterFile(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains(`none of the two`).IsSelected(),
Contains(`both files`),
Contains(`only otherFile`),
Contains(`only filterFile`),
).
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter path to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter path:")).
Type("filterF").
SuggestionLines(Equals("filterFile")).
ConfirmFirstSuggestion()
}
func postFilterTest(t *TestDriver) {
t.Views().Information().Content(Contains("Filtering by 'filterFile'"))
t.Views().Commits().
IsFocused().
Lines(
Contains(`both files`).IsSelected(),
Contains(`only filterFile`),
)
// we only show the filtered file's changes in the main view
t.Views().Main().
ContainsLines(
Equals(" both files"),
Equals("---"),
Equals(" filterFile | 2 +-"),
Equals(" 1 file changed, 1 insertion(+), 1 deletion(-)"),
)
t.Views().Commits().
PressEnter()
// when you click into the commit itself, you see all files from that commit
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /"),
Contains(`filterFile`),
Contains(`otherFile`),
)
}
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/type_file.go | pkg/integration/tests/filter_by_path/type_file.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var TypeFile = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, by finding file in UI and filtering on it",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter path to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter path:")).
Type("filterF").
SuggestionLines(Equals("filterFile")).
ConfirmFirstSuggestion()
postFilterTest(t)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/show_diffs_for_renamed_file.go | pkg/integration/tests/filter_by_path/show_diffs_for_renamed_file.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ShowDiffsForRenamedFile = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path for a file that was renamed, and verify that it shows the diffs correctly",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("oldFile", "a\nb\nc\n")
shell.Commit("add old file")
shell.UpdateFileAndAdd("oldFile", "x\nb\nc\n")
shell.Commit("update old file")
shell.CreateFileAndAdd("unrelatedFile", "content of unrelated file\n")
shell.Commit("add unrelated file")
shell.RenameFileInGit("oldFile", "newFile")
shell.Commit("rename file")
shell.UpdateFileAndAdd("newFile", "y\nb\nc\n")
shell.UpdateFileAndAdd("unrelatedFile", "updated content of unrelated file\n")
shell.Commit("update both files")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("update both files").IsSelected(),
Contains("rename file"),
Contains("add unrelated file"),
Contains("update old file"),
Contains("add old file"),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" M newFile"),
Equals(" M unrelatedFile"),
).
SelectNextItem().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().Title(Equals("Filtering")).
Select(Contains("Filter by 'newFile'")).Confirm()
t.Views().Commits().
IsFocused().
Lines(
Contains("update both files").IsSelected(),
Contains("rename file"),
Contains("update old file"),
Contains("add old file"),
)
t.Views().Main().ContainsLines(
Equals(" update both files"),
Equals("---"),
Equals(" newFile | 2 +-"),
Equals(" 1 file changed, 1 insertion(+), 1 deletion(-)"),
Equals(""),
Equals("diff --git a/newFile b/newFile"),
Contains("index"),
Equals("--- a/newFile"),
Equals("+++ b/newFile"),
Equals("@@ -1,3 +1,3 @@"),
Equals("-x"),
Equals("+y"),
Equals(" b"),
Equals(" c"),
)
t.Views().Commits().SelectNextItem()
t.Views().Main().ContainsLines(
Equals(" rename file"),
Equals("---"),
Equals(" oldFile => newFile | 0"),
Equals(" 1 file changed, 0 insertions(+), 0 deletions(-)"),
Equals(""),
Equals("diff --git a/oldFile b/newFile"),
Equals("similarity index 100%"),
Equals("rename from oldFile"),
Equals("rename to newFile"),
)
t.Views().Commits().SelectNextItem()
t.Views().Main().ContainsLines(
Equals(" update old file"),
Equals("---"),
Equals(" oldFile | 2 +-"),
Equals(" 1 file changed, 1 insertion(+), 1 deletion(-)"),
Equals(""),
Equals("diff --git a/oldFile b/oldFile"),
Contains("index"),
Equals("--- a/oldFile"),
Equals("+++ b/oldFile"),
Equals("@@ -1,3 +1,3 @@"),
Equals("-a"),
Equals("+x"),
Equals(" b"),
Equals(" c"),
)
t.Views().Commits().
Press(keys.Universal.RangeSelectUp).
Press(keys.Universal.RangeSelectUp)
t.Views().Main().ContainsLines(
Contains("Showing diff for range"),
Equals(""),
Equals(" oldFile => newFile | 2 +-"),
Equals(" 1 file changed, 1 insertion(+), 1 deletion(-)"),
Equals(""),
Equals("diff --git a/oldFile b/newFile"),
Equals("similarity index 66%"),
Equals("rename from oldFile"),
Equals("rename to newFile"),
Contains("index"),
Equals("--- a/oldFile"),
Equals("+++ b/newFile"),
Equals("@@ -1,3 +1,3 @@"),
Equals("-a"),
Equals("+y"),
Equals(" b"),
Equals(" c"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_path/select_filtered_file_when_entering_commit.go | pkg/integration/tests/filter_by_path/select_filtered_file_when_entering_commit.go | package filter_by_path
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectFilteredFileWhenEnteringCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, then enter a commit and ensure the file is selected",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "")
shell.CreateFileAndAdd("dir/file2", "")
shell.Commit("add files")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter path to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter path:")).
Type("dir/file2").
Confirm()
t.Views().Commits().
Focus().
Lines(
Contains("add files").IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /"),
Equals(" ▼ dir"),
Equals(" A file2").IsSelected(),
Equals(" A file1"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/bisect/basic.go | pkg/integration/tests/bisect/basic.go | package bisect
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Start a git bisect to find a bad commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
NewBranch("mybranch").
CreateNCommits(10)
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
markCommitAsBad := func() {
t.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as bad`)).Confirm()
}
markCommitAsGood := func() {
t.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm()
}
t.Views().Commits().
Focus().
SelectedLine(Contains("CI commit 10")).
NavigateToLine(Contains("CI commit 09")).
Tap(func() {
markCommitAsBad()
t.Views().Information().Content(Contains("Bisecting"))
}).
SelectedLine(Contains("<-- bad")).
NavigateToLine(Contains("CI commit 02")).
Tap(markCommitAsGood).
TopLines(Contains("CI commit 10")).
// lazygit will land us in the commit between our good and bad commits.
SelectedLine(Contains("CI commit 05").Contains("<-- current")).
Tap(markCommitAsBad).
SelectedLine(Contains("CI commit 04").Contains("<-- current")).
Tap(func() {
markCommitAsGood()
// commit 5 is the culprit because we marked 4 as good and 5 as bad.
t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
}).
IsFocused().
Content(Contains("CI commit 04"))
t.Views().Information().Content(DoesNotContain("Bisecting"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/bisect/choose_terms.go | pkg/integration/tests/bisect/choose_terms.go | package bisect
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ChooseTerms = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Start a git bisect by choosing 'broken/fixed' as bisect terms",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
NewBranch("mybranch").
CreateNCommits(10)
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
markCommitAsFixed := func() {
t.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as fixed`)).Confirm()
}
markCommitAsBroken := func() {
t.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as broken`)).Confirm()
}
t.Views().Commits().
Focus().
SelectedLine(Contains("CI commit 10")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(Contains("Choose bisect terms")).Confirm()
t.ExpectPopup().Prompt().Title(Equals("Term for old/good commit:")).Type("broken").Confirm()
t.ExpectPopup().Prompt().Title(Equals("Term for new/bad commit:")).Type("fixed").Confirm()
}).
NavigateToLine(Contains("CI commit 09")).
Tap(markCommitAsFixed).
SelectedLine(Contains("<-- fixed")).
NavigateToLine(Contains("CI commit 02")).
Tap(markCommitAsBroken).
Lines(
Contains("CI commit 10").DoesNotContain("<--"),
Contains("CI commit 09").Contains("<-- fixed"),
Contains("CI commit 08").DoesNotContain("<--"),
Contains("CI commit 07").DoesNotContain("<--"),
Contains("CI commit 06").DoesNotContain("<--"),
Contains("CI commit 05").Contains("<-- current").IsSelected(),
Contains("CI commit 04").DoesNotContain("<--"),
Contains("CI commit 03").DoesNotContain("<--"),
Contains("CI commit 02").Contains("<-- broken"),
Contains("CI commit 01").DoesNotContain("<--"),
).
Tap(markCommitAsFixed).
SelectedLine(Contains("CI commit 04").Contains("<-- current")).
Tap(func() {
markCommitAsBroken()
// commit 5 is the culprit because we marked 4 as broken and 5 as fixed.
t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
}).
IsFocused().
Content(Contains("CI commit 04"))
t.Views().Information().Content(DoesNotContain("Bisecting"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/bisect/from_other_branch.go | pkg/integration/tests/bisect/from_other_branch.go | package bisect
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Opening lazygit when bisect has been started from another branch. There's an issue where we don't reselect the current branch if we mark the current branch as bad so this test side-steps that problem",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("only commit on master"). // this'll ensure we have a master branch
NewBranch("other").
CreateNCommits(10).
Checkout("master").
StartBisect("other~2", "other~5")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Information().Content(Contains("Bisecting"))
t.Views().Commits().
Focus().
TopLines(
MatchesRegexp(`<-- bad.*commit 08`),
MatchesRegexp(`<-- current.*commit 07`),
MatchesRegexp(`\?.*commit 06`),
MatchesRegexp(`<-- good.*commit 05`),
).
SelectNextItem().
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm()
t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm()
t.Views().Information().Content(DoesNotContain("Bisecting"))
}).
// back in master branch which just had the one commit
Lines(
Contains("only commit on master"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/bisect/skip.go | pkg/integration/tests/bisect/skip.go | package bisect
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Skip = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Start a git bisect and skip a few commits (selected or current)",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
CreateNCommits(10)
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
SelectedLine(Contains("commit 10")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as bad`)).Confirm()
}).
NavigateToLine(Contains("commit 01")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm()
t.Views().Information().Content(Contains("Bisecting"))
}).
Lines(
Contains("CI commit 10").Contains("<-- bad"),
Contains("CI commit 09").DoesNotContain("<--"),
Contains("CI commit 08").DoesNotContain("<--"),
Contains("CI commit 07").DoesNotContain("<--"),
Contains("CI commit 06").DoesNotContain("<--"),
Contains("CI commit 05").Contains("<-- current").IsSelected(),
Contains("CI commit 04").DoesNotContain("<--"),
Contains("CI commit 03").DoesNotContain("<--"),
Contains("CI commit 02").DoesNotContain("<--"),
Contains("CI commit 01").Contains("<-- good"),
).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).
// Does not show a "Skip selected commit" entry:
Lines(
Contains("b Mark current commit").Contains("as bad"),
Contains("g Mark current commit").Contains("as good"),
Contains("s Skip current commit"),
Contains("r Reset bisect"),
Contains("Cancel"),
).
Select(Contains("Skip current commit")).Confirm()
}).
// Skipping the current commit selects the new current commit:
Lines(
Contains("CI commit 10").Contains("<-- bad"),
Contains("CI commit 09").DoesNotContain("<--"),
Contains("CI commit 08").DoesNotContain("<--"),
Contains("CI commit 07").DoesNotContain("<--"),
Contains("CI commit 06").Contains("<-- current").IsSelected(),
Contains("CI commit 05").Contains("<-- skipped"),
Contains("CI commit 04").DoesNotContain("<--"),
Contains("CI commit 03").DoesNotContain("<--"),
Contains("CI commit 02").DoesNotContain("<--"),
Contains("CI commit 01").Contains("<-- good"),
).
NavigateToLine(Contains("commit 07")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Bisect")).
// Does show a "Skip selected commit" entry:
Lines(
Contains("b Mark current commit").Contains("as bad"),
Contains("g Mark current commit").Contains("as good"),
Contains("s Skip current commit"),
Contains("S Skip selected commit"),
Contains("r Reset bisect"),
Contains("Cancel"),
).
Select(Contains("Skip selected commit")).Confirm()
}).
// Skipping a selected, non-current commit keeps the selection
// there:
SelectedLine(Contains("CI commit 07").Contains("<-- skipped"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/associate_branch_rebase.go | pkg/integration/tests/worktree/associate_branch_rebase.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This is important because `git worktree list` will show a worktree being in a detached head state (which is true)
// when it's in the middle of a rebase, but it won't tell you about the branch it's on.
// Even so, if you attempt to check out that branch from another worktree git won't let you, so we need to
// keep track of the association ourselves.
// We need different logic for associated the branch depending on whether it's a main worktree or
// linked worktree, so this test handles both.
var AssociateBranchRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that when you start a rebase in a linked or main worktree, Lazygit still associates the worktree with the branch",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").IsSelected(),
Contains("newbranch (worktree)"),
)
// start a rebase on the main worktree
t.Views().Commits().
Focus().
NavigateToLine(Contains("commit 2")).
Press(keys.Universal.Edit)
t.Views().Information().Content(Contains("Rebasing"))
t.Views().Branches().
Focus().
// switch to linked worktree
NavigateToLine(Contains("newbranch")).
Press(keys.Universal.Select).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Switch to worktree")).
Content(Equals("This branch is checked out by worktree linked-worktree. Do you want to switch to that worktree?")).
Confirm()
t.Views().Information().Content(DoesNotContain("Rebasing"))
}).
Lines(
Contains("newbranch").IsSelected(),
Contains("mybranch (worktree)"),
)
// start a rebase on the linked worktree
t.Views().Commits().
Focus().
NavigateToLine(Contains("commit 2")).
Press(keys.Universal.Edit)
t.Views().Information().Content(Contains("Rebasing"))
// switch back to main worktree
t.Views().Branches().
Focus().
NavigateToLine(Contains("mybranch")).
Press(keys.Universal.Select).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Switch to worktree")).
Content(Equals("This branch is checked out by worktree repo. Do you want to switch to that worktree?")).
Confirm()
}).
Lines(
Contains("(no branch").IsSelected(),
Contains("mybranch"),
// even though the linked worktree is rebasing, we still associate it with the branch
Contains("newbranch (worktree)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/force_remove_worktree_with_submodules.go | pkg/integration/tests/worktree/force_remove_worktree_with_submodules.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ForceRemoveWorktreeWithSubmodules = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Force remove a worktree that contains submodules",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.CloneIntoSubmodule("submodule", "submodule")
shell.Commit("Add submodule")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.RunCommand([]string{"git", "-C", "../linked-worktree", "submodule", "update", "--init"})
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
).
NavigateToLine(Contains("linked-worktree")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("Are you sure you want to remove worktree 'linked-worktree'?")).
Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("'linked-worktree' contains modified or untracked files, or submodules (or all of these). Are you sure you want to remove it?")).
Confirm()
}).
Lines(
Contains("repo (main)").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/detach_worktree_from_branch.go | pkg/integration/tests/worktree/detach_worktree_from_branch.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DetachWorktreeFromBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Detach a worktree from the branches view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").IsSelected(),
Contains("newbranch (worktree)"),
).
NavigateToLine(Contains("newbranch")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'newbranch'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Branch newbranch is checked out by worktree linked-worktree")).
Select(Equals("Detach worktree")).
Confirm()
}).
Lines(
Contains("mybranch"),
Contains("newbranch").DoesNotContain("(worktree)").IsSelected(),
)
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/worktree_in_repo.go | pkg/integration/tests/worktree/worktree_in_repo.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var WorktreeInRepo = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a worktree inside the repo, then remove the directory and confirm the worktree is removed",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("mybranch"),
)
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)"),
).
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Worktree")).
Select(Contains(`Create worktree from ref`).DoesNotContain(("detached"))).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree base ref")).
InitialText(Equals("mybranch")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree path")).
Type("linked-worktree").
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New branch name (leave blank to checkout mybranch)")).
Type("newbranch").
Confirm()
}).
Lines(
Contains("linked-worktree").IsSelected(),
Contains("repo (main)"),
).
// switch back to main worktree
NavigateToLine(Contains("repo (main)")).
Press(keys.Universal.Select).
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
)
t.Views().Files().
Focus().
Lines(
Contains("linked-worktree"),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Discard changes")).
Select(Contains("Discard all changes")).
Confirm()
}).
IsEmpty()
// confirm worktree appears as missing
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree (missing)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/associate_branch_bisect.go | pkg/integration/tests/worktree/associate_branch_bisect.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This is important because `git worktree list` will show a worktree being in a detached head state (which is true)
// when it's in the middle of a bisect, but it won't tell you about the branch it's on.
// Even so, if you attempt to check out that branch from another worktree git won't let you, so we need to
// keep track of the association ourselves.
// not bothering to test the linked worktree here because it's the same logic as the rebase test
var AssociateBranchBisect = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that when you start a bisect in a linked worktree, Lazygit still associates the worktree with the branch",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").IsSelected(),
Contains("newbranch (worktree)"),
)
// start a bisect on the main worktree
t.Views().Commits().
Focus().
SelectedLine(Contains("commit 3")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Bisect")).
Select(MatchesRegexp(`Mark .* as bad`)).
Confirm()
t.Views().Information().Content(Contains("Bisecting"))
}).
NavigateToLine(Contains("initial commit")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Bisect")).
Select(MatchesRegexp(`Mark .* as good`)).
Confirm()
})
t.Views().Branches().
Focus().
// switch to linked worktree
NavigateToLine(Contains("newbranch")).
Press(keys.Universal.Select).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Switch to worktree")).
Content(Equals("This branch is checked out by worktree linked-worktree. Do you want to switch to that worktree?")).
Confirm()
t.Views().Information().Content(DoesNotContain("Bisecting"))
}).
Lines(
Contains("newbranch").IsSelected(),
Contains("mybranch (worktree)"),
)
// switch back to main worktree
t.Views().Branches().
Focus().
NavigateToLine(Contains("mybranch")).
Press(keys.Universal.Select).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Switch to worktree")).
Content(Equals("This branch is checked out by worktree repo. Do you want to switch to that worktree?")).
Confirm()
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/remove_worktree_from_branch.go | pkg/integration/tests/worktree/remove_worktree_from_branch.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RemoveWorktreeFromBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Remove a worktree from the branches view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").IsSelected(),
Contains("newbranch (worktree)"),
).
NavigateToLine(Contains("newbranch")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'newbranch'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Branch newbranch is checked out by worktree linked-worktree")).
Select(Equals("Remove worktree")).
Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("Are you sure you want to remove worktree 'linked-worktree'?")).
Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("'linked-worktree' contains modified or untracked files, or submodules (or all of these). Are you sure you want to remove it?")).
Confirm()
}).
Lines(
Contains("mybranch"),
Contains("newbranch").DoesNotContain("(worktree)").IsSelected(),
)
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/crud.go | pkg/integration/tests/worktree/crud.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Crud = NewIntegrationTest(NewIntegrationTestArgs{
Description: "From the worktrees view, add a work tree, switch to it, switch back, and remove it",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("mybranch"),
)
t.Views().Status().
Lines(
Contains("repo → mybranch"),
)
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)"),
).
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Worktree")).
Select(Contains(`Create worktree from ref`).DoesNotContain(("detached"))).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree base ref")).
InitialText(Equals("mybranch")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree path")).
Type("../linked-worktree").
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New branch name (leave blank to checkout mybranch)")).
Type("newbranch").
Confirm()
}).
Lines(
Contains("linked-worktree").IsSelected(),
Contains("repo (main)"),
).
// confirm we're still in the same view
IsFocused()
// status panel includes the worktree if it's a linked worktree
t.Views().Status().
Lines(
Contains("repo(linked-worktree) → newbranch"),
)
t.Views().Branches().
Lines(
Contains("newbranch"),
Contains("mybranch"),
)
t.Views().Worktrees().
// confirm we can't remove the current worktree
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Equals("You cannot remove the current worktree!")).
Confirm()
}).
// confirm we cannot remove the main worktree
NavigateToLine(Contains("repo (main)")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Equals("You cannot remove the main worktree!")).
Confirm()
}).
// switch back to main worktree
Press(keys.Universal.Select).
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
)
t.Views().Branches().
Lines(
Contains("mybranch"),
Contains("newbranch"),
)
t.Views().Worktrees().
// remove linked worktree
NavigateToLine(Contains("linked-worktree")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Contains("Are you sure you want to remove worktree 'linked-worktree'?")).
Confirm()
}).
Lines(
Contains("repo (main)").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/force_remove_worktree.go | pkg/integration/tests/worktree/force_remove_worktree.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ForceRemoveWorktree = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Force remove a dirty worktree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
).
NavigateToLine(Contains("linked-worktree")).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("Are you sure you want to remove worktree 'linked-worktree'?")).
Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Remove worktree")).
Content(Equals("'linked-worktree' contains modified or untracked files, or submodules (or all of these). Are you sure you want to remove it?")).
Confirm()
}).
Lines(
Contains("repo (main)").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/custom_command.go | pkg/integration/tests/worktree/custom_command.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CustomCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that custom commands work with worktrees by deleting a worktree via a custom command",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "d",
Context: "worktrees",
Command: "git worktree remove {{ .SelectedWorktree.Path | quote }}",
},
}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)"),
Contains("linked-worktree"),
).
NavigateToLine(Contains("linked-worktree")).
Press("d").
Lines(
Contains("repo (main)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/symlink_into_repo_subdir.go | pkg/integration/tests/worktree/symlink_into_repo_subdir.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SymlinkIntoRepoSubdir = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in a symlink into a repo's subdirectory",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.ShowFileTree = false
},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - repo/a/b/c (main worktree with subdirs)
// - link (symlink to repo/a/b/c)
//
shell.CreateFileAndAdd("a/b/c/blah", "blah\n")
shell.Commit("initial commit")
shell.UpdateFile("a/b/c/blah", "updated content\n")
shell.Chdir("..")
shell.RunCommand([]string{"ln", "-s", "repo/a/b/c", "link"})
shell.Chdir("link")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("master"),
)
t.Views().Commits().
Lines(
Contains("initial commit"),
)
t.Views().Files().
IsFocused().
Lines(
Contains(" M a/b/c/blah"), // shows as modified
).
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Add blah").
Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Lines(
Contains("Add blah"),
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/worktree/dotfile_bare_repo.go | pkg/integration/tests/worktree/dotfile_bare_repo.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Can't think of a better name than 'dotfile' repo: I'm using that
// because that's the case we're typically dealing with.
var DotfileBareRepo = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in the worktree of a dotfile bare repo and add a file and commit",
ExtraCmdArgs: []string{"--git-dir={{.actualPath}}/.bare", "--work-tree={{.actualPath}}/repo"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - .bare
// - repo (the worktree)
//
// The first repo is called 'repo' because that's the
// directory that all lazygit tests start in
// Delete the .git dir that all tests start with by default
shell.DeleteFile(".git")
// Create a bare repo in the parent directory
shell.RunCommand([]string{"git", "init", "--bare", "../.bare"})
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "checkout", "-b", "mybranch"})
shell.CreateFile("blah", "original content\n")
// Add a file and commit
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "add", "blah"})
shell.RunCommand([]string{"git", "--git-dir=../.bare", "--work-tree=.", "commit", "-m", "initial commit"})
shell.UpdateFile("blah", "updated content\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("mybranch"),
)
t.Views().Commits().
Lines(
Contains("initial commit"),
)
t.Views().Files().
IsFocused().
Lines(
Contains(" M blah"), // shows as modified
).
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Add blah").
Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Lines(
Contains("Add blah"),
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/worktree/double_nested_linked_submodule.go | pkg/integration/tests/worktree/double_nested_linked_submodule.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Even though this involves submodules, it's a worktree test since
// it's really exercising lazygit's ability to correctly do pathfinding
// in a complex use case.
var DoubleNestedLinkedSubmodule = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in a link to a repo's double nested submodules",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.ShowFileTree = false
},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - repo/outerSubmodule/innerSubmodule/a/b/c
// - link (symlink to repo/outerSubmodule/innerSubmodule/a/b/c)
//
shell.CreateFileAndAdd("rootFile", "rootStuff")
shell.Commit("initial repo commit")
shell.Chdir("..")
shell.CreateDir("innerSubmodule")
shell.Chdir("innerSubmodule")
shell.Init()
shell.CreateFileAndAdd("a/b/c/blah", "blah\n")
shell.Commit("initial inner commit")
shell.Chdir("..")
shell.CreateDir("outerSubmodule")
shell.Chdir("outerSubmodule")
shell.Init()
shell.CreateFileAndAdd("foo", "foo")
shell.Commit("initial outer commit")
// the git config (-c) parameter below is required
// to let git create a file-protocol/path submodule
shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "add", "../innerSubmodule"})
shell.Commit("add dependency as innerSubmodule")
shell.Chdir("../repo")
shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "add", "../outerSubmodule"})
shell.Commit("add dependency as outerSubmodule")
shell.Chdir("outerSubmodule")
shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "update", "--init", "--recursive"})
shell.Chdir("innerSubmodule")
shell.UpdateFile("a/b/c/blah", "updated content\n")
shell.Chdir("../../..")
shell.RunCommand([]string{"ln", "-s", "repo/outerSubmodule/innerSubmodule/a/b/c", "link"})
shell.Chdir("link")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("HEAD detached"),
Contains("master"),
)
t.Views().Commits().
Lines(
Contains("initial inner commit"),
)
t.Views().Files().
IsFocused().
Lines(
Contains(" M a/b/c/blah"), // shows as modified
).
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Update blah").
Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Lines(
Contains("Update blah"),
Contains("initial inner commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/reset_window_tabs.go | pkg/integration/tests/worktree/reset_window_tabs.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This is verifying logic that is subject to change (we're just doing the easiest approach)
// There are two other UX flows we could have:
// 1) associate window tab states with the repo, so that when you switch back to a repo you get the same window tab states
// 2) retain the same window tab states when switching repos
// Option 1 is straightforward, but option 2 is harder because you'd need to deactivate any views containing dependent
// content e.g. the sub-commits view.
var ResetWindowTabs = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that window tabs are reset whenever switching repos",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// focus the remotes tab i.e. the second tab in the branches window
t.Views().Remotes().
Focus()
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
).
NavigateToLine(Contains("linked-worktree")).
Press(keys.Universal.Select).
Lines(
Contains("linked-worktree").IsSelected(),
Contains("repo (main)"),
).
// navigate back to the branches window
Press(keys.Universal.NextBlock)
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/worktree/bare_repo.go | pkg/integration/tests/worktree/bare_repo.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var BareRepo = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in the worktree of a bare repo and do a rebase/bisect",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - .bare
// - repo (a worktree)
// - worktree2 (another worktree)
//
// The first repo is called 'repo' because that's the
// directory that all lazygit tests start in
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("blah", "blah")
shell.Commit("initial commit")
shell.EmptyCommit("commit two")
shell.EmptyCommit("commit three")
shell.RunCommand([]string{"git", "clone", "--bare", ".", "../.bare"})
shell.DeleteFile(".git")
shell.Chdir("..")
// This is the dir we were just in (and the dir that lazygit starts in when the test runs)
// We're going to replace it with a worktree
shell.DeleteFile("repo")
shell.RunCommand([]string{"git", "--git-dir", ".bare", "worktree", "add", "-b", "repo", "repo", "mybranch"})
shell.RunCommand([]string{"git", "--git-dir", ".bare", "worktree", "add", "-b", "worktree2", "worktree2", "mybranch"})
shell.Chdir("repo")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("repo"),
Contains("mybranch"),
Contains("worktree2 (worktree)"),
)
// test that a rebase works fine
// (rebase uses the git dir of the worktree so we're confirming that it points
// to the right git dir)
t.Views().Commits().
Focus().
Lines(
Contains("commit three").IsSelected(),
Contains("commit two"),
Contains("initial commit"),
).
Press(keys.Commits.MoveDownCommit).
Lines(
Contains("commit two"),
Contains("commit three").IsSelected(),
Contains("initial commit"),
).
// test that bisect works fine (same logic as above)
NavigateToLine(Contains("commit two")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Bisect")).
Select(MatchesRegexp(`Mark .* as bad`)).
Confirm()
t.Views().Information().Content(Contains("Bisecting"))
}).
NavigateToLine(Contains("initial commit")).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Bisect")).
Select(MatchesRegexp(`Mark .* as good`)).
Confirm()
t.Views().Information().Content(Contains("Bisecting"))
})
// switch to other worktree
t.Views().Worktrees().
Focus().
Lines(
Contains("repo").IsSelected(),
Contains("worktree2"),
).
NavigateToLine(Contains("worktree2")).
Press(keys.Universal.Select).
Lines(
Contains("worktree2").IsSelected(),
Contains("repo"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/add_from_commit.go | pkg/integration/tests/worktree/add_from_commit.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddFromCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a worktree via the commits view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("commit two")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit two").IsSelected(),
Contains("initial commit"),
).
NavigateToLine(Contains("initial commit")).
Press(keys.Worktrees.ViewWorktreeOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Worktree")).
Select(MatchesRegexp(`Create worktree from .*`).DoesNotContain("detached")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree path")).
Type("../linked-worktree").
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New branch name")).
Type("newbranch").
Confirm()
}).
Lines(
Contains("initial commit"),
)
// Confirm we're now in the branches view
t.Views().Branches().
IsFocused().
Lines(
Contains("newbranch").IsSelected(),
Contains("mybranch (worktree)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/exclude_file_in_worktree.go | pkg/integration/tests/worktree/exclude_file_in_worktree.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ExcludeFileInWorktree = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a file to .git/info/exclude in a worktree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("commit1")
shell.AddWorktree("HEAD", "../linked-worktree", "mybranch")
shell.CreateFile("../linked-worktree/toExclude", "")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().
Focus().
Lines(
Contains("repo (main)").IsSelected(),
Contains("linked-worktree"),
).
SelectNextItem().
PressPrimaryAction()
t.Views().Files().
Focus().
Lines(
Contains("toExclude"),
).
Press(keys.Files.IgnoreFile).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm()
}).
IsEmpty()
t.FileSystem().FileContent("../repo/.git/info/exclude", Contains("toExclude"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/fast_forward_worktree_branch_should_not_pollute_current_worktree.go | pkg/integration/tests/worktree/fast_forward_worktree_branch_should_not_pollute_current_worktree.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FastForwardWorktreeBranchShouldNotPolluteCurrentWorktree = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fast-forward a linked worktree branch from another worktree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// both main and linked worktree will have changed to fast-forward
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.NewBranch("newbranch")
shell.CloneIntoRemote("origin")
shell.SetBranchUpstream("mybranch", "origin/mybranch")
shell.SetBranchUpstream("newbranch", "origin/newbranch")
// remove the 'three' commit so that we have something to pull from the remote
shell.HardReset("HEAD^")
shell.Checkout("mybranch")
shell.HardReset("HEAD^")
shell.AddWorktreeCheckout("newbranch", "../linked-worktree")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").Contains("↓1").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
NavigateToLine(Contains("newbranch (worktree)")).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓"),
Contains("newbranch (worktree)").Contains("✓").IsSelected(),
).
NavigateToLine(Contains("mybranch"))
// check the current worktree that it has no lines in the File changes pane
t.Views().Files().
Focus().
Press(keys.Files.RefreshFiles).
LineCount(EqualsInt(0))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/add_from_branch.go | pkg/integration/tests/worktree/add_from_branch.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddFromBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a worktree via the branches view, then switch back to the main worktree via the branches view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch"),
).
Press(keys.Worktrees.ViewWorktreeOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Worktree")).
Select(Contains(`Create worktree from mybranch`).DoesNotContain("detached")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree path")).
Type("../linked-worktree").
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New branch name")).
Type("newbranch").
Confirm()
}).
// confirm we're still focused on the branches view
IsFocused().
Lines(
Contains("newbranch").IsSelected(),
Contains("mybranch (worktree)"),
).
NavigateToLine(Contains("mybranch")).
Press(keys.Universal.Select).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Switch to worktree")).
Content(Equals("This branch is checked out by worktree repo. Do you want to switch to that worktree?")).
Confirm()
}).
Lines(
Contains("mybranch").IsSelected(),
Contains("newbranch (worktree)"),
).
// Confirm the files view is still showing in the files window
Press(keys.Universal.PrevBlock)
t.Views().Files().
IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/add_from_branch_detached.go | pkg/integration/tests/worktree/add_from_branch_detached.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddFromBranchDetached = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add a detached worktree via the branches view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch"),
).
Press(keys.Worktrees.ViewWorktreeOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Worktree")).
Select(Contains(`Create worktree from mybranch (detached)`)).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("New worktree path")).
Type("../linked-worktree").
Confirm()
}).
// confirm we're still focused on the branches view
IsFocused().
Lines(
Contains("(no branch)").IsSelected(),
Contains("mybranch (worktree)"),
)
t.Views().Status().
Content(Contains("repo(linked-worktree)"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/fast_forward_worktree_branch.go | pkg/integration/tests/worktree/fast_forward_worktree_branch.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FastForwardWorktreeBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fast-forward a linked worktree branch from another worktree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// both main and linked worktree will have changed to fast-forward
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.NewBranch("newbranch")
shell.CloneIntoRemote("origin")
shell.SetBranchUpstream("mybranch", "origin/mybranch")
shell.SetBranchUpstream("newbranch", "origin/newbranch")
// remove the 'three' commit so that we have something to pull from the remote
shell.HardReset("HEAD^")
shell.Checkout("mybranch")
shell.HardReset("HEAD^")
shell.AddWorktreeCheckout("newbranch", "../linked-worktree")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").Contains("↓1").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
NavigateToLine(Contains("newbranch (worktree)")).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓"),
Contains("newbranch (worktree)").Contains("✓").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/worktree/bare_repo_worktree_config.go | pkg/integration/tests/worktree/bare_repo_worktree_config.go | package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This case is identical to dotfile_bare_repo.go, except
// that it invokes lazygit with $GIT_DIR set but not
// $GIT_WORK_TREE. Instead, the repo uses the core.worktree
// config to identify the main worktree.
var BareRepoWorktreeConfig = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open lazygit in the worktree of a vcsh-style bare repo and add a file and commit",
ExtraCmdArgs: []string{"--git-dir={{.actualPath}}/.bare"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.ShowFileTree = false
},
SetupRepo: func(shell *Shell) {
// we're going to have a directory structure like this:
// project
// - .bare
// - . (a worktree at the same path as .bare)
//
//
// 'repo' is the repository/directory that all lazygit tests start in
shell.CreateFileAndAdd("a/b/c/blah", "blah\n")
shell.Commit("initial commit")
shell.CreateFileAndAdd(".gitignore", ".bare/\n/repo\n")
shell.Commit("add .gitignore")
shell.Chdir("..")
// configure this "fake bare"" repo using the vcsh convention
// of core.bare=false and core.worktree set to the actual
// worktree path (a homedir root). This allows $GIT_DIR
// alone to make this repo "self worktree identifying"
shell.RunCommand([]string{"git", "--git-dir=./.bare", "init", "--shared=false"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "config", "core.bare", "false"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "config", "core.worktree", ".."})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "remote", "add", "origin", "./repo"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "checkout", "-b", "main"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "config", "branch.main.remote", "origin"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "config", "branch.main.merge", "refs/heads/master"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "fetch", "origin", "master"})
shell.RunCommand([]string{"git", "--git-dir=./.bare", "-c", "merge.ff=true", "merge", "origin/master"})
// we no longer need the original repo so remove it
shell.DeleteFile("repo")
shell.UpdateFile("a/b/c/blah", "updated content\n")
shell.Chdir("a/b/c")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("main"),
)
t.Views().Commits().
Lines(
Contains("add .gitignore"),
Contains("initial commit"),
)
t.Views().Files().
IsFocused().
Lines(
Contains(" M a/b/c/blah"), // shows as modified
).
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Add blah").
Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Lines(
Contains("Add blah"),
Contains("add .gitignore"),
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/filter_by_author/select_author.go | pkg/integration/tests/filter_by_author/select_author.go | package filter_by_author
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits using the currently highlighted commit's author when the commit view is active",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.Log.ShowGraph = "never"
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
SelectedLineIdx(0).
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Filter by 'Paul Oberstein <paul.oberstein@email.com>'")).
Confirm()
t.Views().Commits().
IsFocused().
Lines(
Contains("commit 7"),
Contains("commit 6"),
Contains("commit 5"),
Contains("commit 4"),
Contains("commit 3"),
Contains("commit 2"),
Contains("commit 1"),
Contains("commit 0"),
)
t.Views().Information().Content(Contains("Filtering by 'Paul Oberstein <paul.oberstein@email.com>'"))
t.Views().Commits().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Stop filtering")).
Confirm()
t.Views().Commits().
IsFocused().
NavigateToLine(Contains("SK commit 0")).
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Filter by 'Siegfried Kircheis <siegfried.kircheis@email.com>'")).
Confirm()
t.Views().Commits().
IsFocused().
Lines(
Contains("commit 0"),
)
t.Views().Information().Content(Contains("Filtering by 'Siegfried Kircheis <siegfried.kircheis@email.com>'"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_author/shared.go | pkg/integration/tests/filter_by_author/shared.go | package filter_by_author
import (
"fmt"
"strings"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
type AuthorInfo struct {
name string
numberOfCommits int
}
func commonSetup(shell *Shell) {
authors := []AuthorInfo{{"Yang Wen-li", 3}, {"Siegfried Kircheis", 1}, {"Paul Oberstein", 8}}
totalCommits := 0
repoStartDaysAgo := 100
for _, authorInfo := range authors {
for i := range authorInfo.numberOfCommits {
authorEmail := strings.ToLower(strings.ReplaceAll(authorInfo.name, " ", ".")) + "@email.com"
commitMessage := fmt.Sprintf("commit %d", i)
shell.SetAuthor(authorInfo.name, authorEmail)
shell.EmptyCommitDaysAgo(commitMessage, repoStartDaysAgo-totalCommits)
totalCommits++
}
}
}
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_by_author/type_author.go | pkg/integration/tests/filter_by_author/type_author.go | package filter_by_author
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var TypeAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by author using the typed in author",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
commonSetup(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Status().
Focus().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter author to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter author:")).
Type("Yang").
SuggestionLines(Equals("Yang Wen-li <yang.wen-li@email.com>")).
ConfirmFirstSuggestion()
t.Views().Commits().
IsFocused().
Lines(
Contains("commit 2"),
Contains("commit 1"),
Contains("commit 0"),
)
t.Views().Information().Content(Contains("Filtering by 'Yang Wen-li <yang.wen-li@email.com>'"))
t.Views().Status().
Focus().
Press(keys.Universal.FilteringMenu)
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Enter author to filter by")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Enter author:")).
Type("Siegfried").
SuggestionLines(Equals("Siegfried Kircheis <siegfried.kircheis@email.com>")).
ConfirmFirstSuggestion()
t.Views().Commits().
IsFocused().
Lines(
Contains("commit 0"),
)
t.Views().Information().Content(Contains("Filtering by 'Siegfried Kircheis <siegfried.kircheis@email.com>'"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/merge_file_current.go | pkg/integration/tests/conflicts/merge_file_current.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
func testDataCurrent() (original, current, incoming, final string) {
original = `
1
2
3
4
5
6
`
current = `
1
2
3
4
5a
6
`
incoming = `
1b
2
3
4
5b
6
`
final = `
1b
2
3
4
5a
6
`
return original, current, incoming, final
}
var MergeFileCurrent = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Conflicting file can be resolved to 'ours' (current changes) version via merge-file",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
original, current, incoming, _ := testDataCurrent()
shared.CreateMergeConflictFileForMergeFileTests(shell, original, current, incoming)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
_, _, _, expected := testDataCurrent()
t.Views().Files().
IsFocused().
Lines(
Contains("file").IsSelected(),
)
t.GlobalPress(keys.Files.OpenMergeOptions)
t.ExpectPopup().Menu().
Title(Equals("Resolve merge conflicts")).
Select(Contains("Use current changes")). // merge-file --ours
Confirm()
t.Common().ContinueOnConflictsResolved("merge")
t.Views().Files().IsEmpty()
t.FileSystem().FileContent("file", Equals(expected))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/filter.go | pkg/integration/tests/conflicts/filter.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var Filter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that when there are merge conflicts, the files panel only shows conflicted files",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFiles(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" UU file1"),
Equals(" UU file2"),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("No filter")).
Confirm()
}).
Lines(
Equals("▼ /").IsSelected(),
Equals(" UU file1"),
Equals(" UU file2"),
// now we see the non-merge conflict file
Equals(" A file3"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go | pkg/integration/tests/conflicts/resolve_without_trailing_lf.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResolveWithoutTrailingLf = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Regression test for resolving a merge conflict when the file doesn't have a trailing newline",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
NewBranch("branch1").
CreateFileAndAdd("file", "a\n\nno eol").
Commit("initial commit").
UpdateFileAndAdd("file", "a1\n\nno eol").
Commit("commit on branch1").
NewBranchFrom("branch2", "HEAD^").
UpdateFileAndAdd("file", "a2\n\nno eol").
Commit("commit on branch2").
Checkout("branch1").
RunCommandExpectError([]string{"git", "merge", "--no-edit", "branch2"})
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("UU file").IsSelected(),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("a1"),
Contains("======="),
).
SelectNextItem().
PressPrimaryAction()
t.ExpectPopup().Alert().
Title(Equals("Continue")).
Content(Contains("All merge conflicts resolved. Continue the merge?")).
Cancel()
t.Views().Files().
Focus().
Lines(
Contains("M file").IsSelected(),
)
t.Views().Main().Content(Contains("-a1\n+a2\n").DoesNotContain("-no eol"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/undo_choose_hunk.go | pkg/integration/tests/conflicts/undo_choose_hunk.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var UndoChooseHunk = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Chooses a hunk when resolving a merge conflict and then undoes the choice",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFileMultiple(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("UU file").IsSelected(),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
Content(Contains("<<<<<<< HEAD\nFirst Change")).
// explicitly asserting on the selection because sometimes the content renders
// before the selection is ready for user input
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction().
// choosing the first hunk
Content(DoesNotContain("<<<<<<< HEAD\nFirst Change")).
Press(keys.Universal.Undo).
Content(Contains("<<<<<<< HEAD\nFirst Change"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/merge_file_incoming.go | pkg/integration/tests/conflicts/merge_file_incoming.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
func testDataIncoming() (original, current, incoming, final string) {
original = `
1
2
3
4
5
6
`
current = `
1a
2
3
4
5a
6
`
incoming = `
1
2
3
4
5b
6
`
final = `
1a
2
3
4
5b
6
`
return original, current, incoming, final
}
var MergeFileIncoming = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Conflicting file can be resolved to 'theirs' (incoming changes) version via merge-file",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
original, current, incoming, _ := testDataIncoming()
shared.CreateMergeConflictFileForMergeFileTests(shell, original, current, incoming)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
_, _, _, expected := testDataIncoming()
t.Views().Files().
IsFocused().
Lines(
Contains("file").IsSelected(),
)
t.GlobalPress(keys.Files.OpenMergeOptions)
t.ExpectPopup().Menu().
Title(Equals("Resolve merge conflicts")).
Select(Contains("Use incoming changes")). // merge-file --theirs
Confirm()
t.Common().ContinueOnConflictsResolved("merge")
t.Views().Files().IsEmpty()
t.FileSystem().FileContent("file", Equals(expected))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/resolve_no_auto_stage.go | pkg/integration/tests/conflicts/resolve_no_auto_stage.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var ResolveNoAutoStage = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Resolving conflicts without auto-staging",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AutoStageResolvedConflicts = false
},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFiles(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" UU file1"),
Equals(" UU file2"),
).
SelectNextItem().
PressEnter()
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Views().Files().
IsFocused().
// Resolving the conflict didn't auto-stage it
Lines(
Equals("▼ /"),
Equals(" UU file1").IsSelected(),
Equals(" UU file2"),
).
// So do that manually
PressPrimaryAction().
Lines(
Equals("UU file2").IsSelected(),
).
// Trying to stage a file that still has conflicts is not allowed:
PressPrimaryAction().
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Contains("Cannot stage/unstage directory containing files with inline merge conflicts.")).
Confirm()
}).
PressEnter()
// coincidentally these files have the same conflict
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Views().Files().
IsFocused().
// Again, resolving the conflict didn't auto-stage it
Lines(
Equals("UU file2").IsSelected(),
).
// Doing that manually now works:
PressPrimaryAction().
Lines(
Equals("A file3").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/resolve_multiple_files.go | pkg/integration/tests/conflicts/resolve_multiple_files.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that upon resolving conflicts for one file, the next file is selected",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFiles(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" UU file1"),
Equals(" UU file2"),
).
SelectNextItem().
PressEnter()
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Views().Files().
IsFocused().
Lines(
Equals("UU file2").IsSelected(),
).
PressEnter()
// coincidentally these files have the same conflict
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Common().ContinueOnConflictsResolved("merge")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/resolve_non_textual_conflicts.go | pkg/integration/tests/conflicts/resolve_non_textual_conflicts.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResolveNonTextualConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Resolve non-textual merge conflicts (e.g. one side modified, the other side deleted)",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.RunShellCommand(`echo test1 > both-deleted1.txt`)
shell.RunShellCommand(`echo test2 > both-deleted2.txt`)
shell.RunShellCommand(`git checkout -b conflict && git add both-deleted1.txt both-deleted2.txt`)
shell.RunShellCommand(`echo haha1 > deleted-them1.txt && git add deleted-them1.txt`)
shell.RunShellCommand(`echo haha2 > deleted-them2.txt && git add deleted-them2.txt`)
shell.RunShellCommand(`echo haha1 > deleted-us1.txt && git add deleted-us1.txt`)
shell.RunShellCommand(`echo haha2 > deleted-us2.txt && git add deleted-us2.txt`)
shell.RunShellCommand(`git commit -m one`)
// stuff on other branch
shell.RunShellCommand(`git branch conflict_second`)
shell.RunShellCommand(`git mv both-deleted1.txt added-them-changed-us1.txt`)
shell.RunShellCommand(`git mv both-deleted2.txt added-them-changed-us2.txt`)
shell.RunShellCommand(`git rm deleted-them1.txt deleted-them2.txt`)
shell.RunShellCommand(`echo modded1 > deleted-us1.txt && git add deleted-us1.txt`)
shell.RunShellCommand(`echo modded2 > deleted-us2.txt && git add deleted-us2.txt`)
shell.RunShellCommand(`git commit -m "two"`)
// stuff on our branch
shell.RunShellCommand(`git checkout conflict_second`)
shell.RunShellCommand(`git mv both-deleted1.txt changed-them-added-us1.txt`)
shell.RunShellCommand(`git mv both-deleted2.txt changed-them-added-us2.txt`)
shell.RunShellCommand(`echo modded1 > deleted-them1.txt && git add deleted-them1.txt`)
shell.RunShellCommand(`echo modded2 > deleted-them2.txt && git add deleted-them2.txt`)
shell.RunShellCommand(`git rm deleted-us1.txt deleted-us2.txt`)
shell.RunShellCommand(`git commit -m "three"`)
shell.RunShellCommand(`git reset --hard conflict_second`)
shell.RunCommandExpectError([]string{"git", "merge", "conflict"})
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
resolve := func(filename string, menuChoice string) {
t.Views().Files().
NavigateToLine(Contains(filename)).
Tap(func() {
t.Views().Main().Content(Contains("Conflict:"))
}).
Press(keys.Universal.GoInto).
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("Merge conflicts")).
Select(Contains(menuChoice)).
Confirm()
})
}
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" UA added-them-changed-us1.txt"),
Equals(" UA added-them-changed-us2.txt"),
Equals(" DD both-deleted1.txt"),
Equals(" DD both-deleted2.txt"),
Equals(" AU changed-them-added-us1.txt"),
Equals(" AU changed-them-added-us2.txt"),
Equals(" UD deleted-them1.txt"),
Equals(" UD deleted-them2.txt"),
Equals(" DU deleted-us1.txt"),
Equals(" DU deleted-us2.txt"),
).
Tap(func() {
resolve("added-them-changed-us1.txt", "Delete file")
resolve("added-them-changed-us2.txt", "Keep file")
resolve("both-deleted1.txt", "Delete file")
resolve("both-deleted2.txt", "Delete file")
resolve("changed-them-added-us1.txt", "Delete file")
resolve("changed-them-added-us2.txt", "Keep file")
resolve("deleted-them1.txt", "Delete file")
resolve("deleted-them2.txt", "Keep file")
resolve("deleted-us1.txt", "Delete file")
resolve("deleted-us2.txt", "Keep file")
}).
Lines(
Equals("▼ /"),
Equals(" A added-them-changed-us2.txt"),
Equals(" D changed-them-added-us1.txt"),
Equals(" D deleted-them1.txt"),
Equals(" A deleted-us2.txt"),
)
t.FileSystem().
PathNotPresent("added-them-changed-us1.txt").
FileContent("added-them-changed-us2.txt", Equals("test2\n")).
PathNotPresent("both-deleted1.txt").
PathNotPresent("both-deleted2.txt").
PathNotPresent("changed-them-added-us1.txt").
FileContent("changed-them-added-us2.txt", Equals("test2\n")).
PathNotPresent("deleted-them1.txt").
FileContent("deleted-them2.txt", Equals("modded2\n")).
PathNotPresent("deleted-us1.txt").
FileContent("deleted-us2.txt", Equals("modded2\n"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/merge_file_both.go | pkg/integration/tests/conflicts/merge_file_both.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
func testDataBoth() (original, current, incoming, final string) {
original = `
1
2
3
4
5
6
`
current = `
1a
2
3
4
5a
6
`
incoming = `
1
2
3b
4
5b
6
`
final = `
1a
2
3b
4
5a
5b
6
`
return original, current, incoming, final
}
var MergeFileBoth = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Conflicting file can be resolved to 'union' (both changes) version via merge-file",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
original, current, incoming, _ := testDataBoth()
shared.CreateMergeConflictFileForMergeFileTests(shell, original, current, incoming)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
_, _, _, expected := testDataBoth()
t.Views().Files().
IsFocused().
Lines(
Contains("file").IsSelected(),
)
t.GlobalPress(keys.Files.OpenMergeOptions)
t.ExpectPopup().Menu().
Title(Equals("Resolve merge conflicts")).
Select(Contains("Use both")). // merge-file --union
Confirm()
t.Common().ContinueOnConflictsResolved("merge")
t.Views().Files().IsEmpty()
t.FileSystem().FileContent("file", Equals(expected))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/conflicts/resolve_externally.go | pkg/integration/tests/conflicts/resolve_externally.go | package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var ResolveExternally = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that when merge conflicts are resolved outside of lazygit, lazygit prompts you to continue",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFile(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("UU file").IsSelected(),
).
Tap(func() {
t.Shell().UpdateFile("file", "resolved content")
}).
Press(keys.Universal.Refresh)
t.Common().ContinueOnConflictsResolved("merge")
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/shell_commands/basic_shell_command.go | pkg/integration/tests/shell_commands/basic_shell_command.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var BasicShellCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command provided at runtime to create a new file",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("touch file.txt").
Confirm()
t.GlobalPress(keys.Files.RefreshFiles)
t.Views().Files().
IsFocused().
Lines(
Contains("file.txt"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shell_commands/edit_history.go | pkg/integration/tests/shell_commands/edit_history.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var EditHistory = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Edit an entry from the custom commands history",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("echo x").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("ec").
SuggestionLines(
Equals("echo x"),
).
EditSuggestion(Equals("echo x")).
InitialText(Equals("echo x"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shell_commands/complex_shell_command.go | pkg/integration/tests/shell_commands/complex_shell_command.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ComplexShellCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command provided at runtime to create a new file, via a shell command. We invoke custom commands through a shell already. This test proves that we can run a shell within a shell, which requires complex escaping.",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("sh -c \"touch file.txt\"").
Confirm()
t.GlobalPress(keys.Files.RefreshFiles)
t.Views().Files().
IsFocused().
Lines(
Contains("file.txt"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shell_commands/history.go | pkg/integration/tests/shell_commands/history.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var History = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Test that the custom commands history is saved correctly",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("echo 1").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(Contains("1")).
Type("echo 2").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(
// "echo 2" was typed last, so it should come first
Contains("2"),
Contains("1"),
).
Type("echo 3").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(
Contains("3"),
Contains("2"),
Contains("1"),
).
Type("echo 1").
Confirm()
// Executing a command again should move it to the front:
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(
Contains("1"),
Contains("3"),
Contains("2"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shell_commands/omit_from_history.go | pkg/integration/tests/shell_commands/omit_from_history.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var OmitFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Omitting a runtime custom command from history if it begins with space",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("echo aubergine").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(Contains("aubergine")).
SuggestionLines(DoesNotContain("tangerine")).
Type(" echo tangerine").
Confirm()
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(Contains("aubergine")).
SuggestionLines(DoesNotContain("tangerine")).
Cancel()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shell_commands/delete_from_history.go | pkg/integration/tests/shell_commands/delete_from_history.go | package shell_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Delete an entry from the custom commands history",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
createCustomCommand := func(command string) {
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type(command).
Confirm()
}
createCustomCommand("echo 1")
createCustomCommand("echo 2")
createCustomCommand("echo 3")
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(
Contains("3"),
Contains("2"),
Contains("1"),
).
DeleteSuggestion(Contains("2")).
SuggestionLines(
Contains("3"),
Contains("1"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/config/custom_commands_in_per_repo_config.go | pkg/integration/tests/config/custom_commands_in_per_repo_config.go | package config
import (
"path/filepath"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CustomCommandsInPerRepoConfig = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Custom commands in per-repo config add to the global ones instead of replacing them",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
otherRepo, _ := filepath.Abs("../other")
cfg.GetAppState().RecentRepos = []string{otherRepo}
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "global",
Command: "printf 'global X' > file.txt",
},
{
Key: "Y",
Context: "global",
Command: "printf 'global Y' > file.txt",
},
}
},
SetupRepo: func(shell *Shell) {
shell.CloneNonBare("other")
shell.CreateFile("../other/.git/lazygit.yml", `
customCommands:
- key: Y
context: global
command: printf 'local Y' > file.txt
- key: Z
context: global
command: printf 'local Z' > file.txt`)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.OpenRecentRepos)
t.ExpectPopup().Menu().Title(Equals("Recent repositories")).
Lines(
Contains("other").IsSelected(),
Contains("Cancel"),
).Confirm()
t.Views().Status().Content(Contains("other → master"))
t.GlobalPress("X")
t.FileSystem().FileContent("../other/file.txt", Equals("global X"))
t.GlobalPress("Y")
t.FileSystem().FileContent("../other/file.txt", Equals("local Y"))
t.GlobalPress("Z")
t.FileSystem().FileContent("../other/file.txt", Equals("local Z"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/config/negative_refspec.go | pkg/integration/tests/config/negative_refspec.go | package config
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var NegativeRefspec = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Having a config with a negative refspec",
ExtraCmdArgs: []string{},
SetupRepo: func(shell *Shell) {
shell.
SetConfig("remote.origin.fetch", "^refs/heads/test").
CreateNCommits(2)
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// the failure case with an unpatched go-git is that no branches display
t.Views().Branches().
Lines(
Contains("master"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/config/remote_named_star.go | pkg/integration/tests/config/remote_named_star.go | package config
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Having a config remote.*",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
SetConfig("remote.*.prune", "true").
CreateNCommits(2)
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// here we're just asserting that we haven't panicked upon starting lazygit
t.Views().Commits().
Lines(
AnyString(),
AnyString(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/add_co_author_range.go | pkg/integration/tests/commit/add_co_author_range.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddCoAuthorRange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add co-author on a range of commits",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("fourth commit")
shell.EmptyCommit("third commit")
shell.EmptyCommit("second commit")
shell.EmptyCommit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("first commit").IsSelected(),
Contains("second commit"),
Contains("third commit"),
Contains("fourth commit"),
).
SelectNextItem().
Press(keys.Universal.ToggleRangeSelect).
SelectNextItem().
Lines(
Contains("first commit"),
Contains("second commit").IsSelected(),
Contains("third commit").IsSelected(),
Contains("fourth commit"),
).
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains("Add co-author")).
Confirm()
t.ExpectPopup().Prompt().
Title(Contains("Add co-author")).
Type("John Smith <jsmith@gmail.com>").
Confirm()
}).
// exit range selection mode
PressEscape().
SelectNextItem()
t.Views().Main().Content(
Contains("fourth commit").
DoesNotContain("Co-authored-by: John Smith <jsmith@gmail.com>"),
)
t.Views().Commits().
IsFocused().
SelectPreviousItem().
Lines(
Contains("first commit"),
Contains("second commit"),
Contains("third commit").IsSelected(),
Contains("fourth commit"),
)
t.Views().Main().ContainsLines(
Equals(" third commit"),
Equals(" "),
Equals(" Co-authored-by: John Smith <jsmith@gmail.com>"),
)
t.Views().Commits().
IsFocused().
SelectPreviousItem().
Lines(
Contains("first commit"),
Contains("second commit").IsSelected(),
Contains("third commit"),
Contains("fourth commit"),
)
t.Views().Main().ContainsLines(
Equals(" second commit"),
Equals(" "),
Equals(" Co-authored-by: John Smith <jsmith@gmail.com>"),
)
t.Views().Commits().
IsFocused().
SelectPreviousItem().
Lines(
Contains("first commit").IsSelected(),
Contains("second commit"),
Contains("third commit"),
Contains("fourth commit"),
)
t.Views().Main().Content(
Contains("first commit").
DoesNotContain("Co-authored-by: John Smith <jsmith@gmail.com>"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/unstaged.go | pkg/integration/tests/commit/unstaged.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Contains("myfile"),
Contains("myfile2"),
).
SelectNextItem().
PressEnter()
t.Views().Staging().
IsFocused().
Tap(func() {
t.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
t.Views().Staging().SelectedLine(Equals("+myfile content"))
}).
// stage the first line
PressPrimaryAction().
Tap(func() {
t.Views().Staging().Content(DoesNotContain("+myfile content")).
SelectedLine(Equals("+with a second line"))
t.Views().StagingSecondary().Content(Contains("+myfile content"))
}).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Commits().
Lines(
Contains(commitMessage),
)
t.Views().Staging().IsFocused()
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/copy_author_to_clipboard.go | pkg/integration/tests/commit/copy_author_to_clipboard.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// We're emulating the clipboard by writing to a file called clipboard
var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Copy a commit author name to the clipboard",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.SetAuthor("John Doe", "john@doe.com")
shell.EmptyCommit("commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Commit author")).
Confirm()
t.ExpectToast(Equals("Commit author copied to clipboard"))
t.FileSystem().FileContent("clipboard", Equals("John Doe <john@doe.com>"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/revert_merge.go | pkg/integration/tests/commit/revert_merge.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var RevertMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a merge commit and chooses to revert to the parent commit",
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.Commits.RevertCommit)
t.ExpectPopup().Confirmation().
Title(Equals("Revert commit")).
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
Confirm()
t.Views().Commits().IsFocused().
TopLines(
Contains("Revert \"Merge branch 'second-change-branch' into first-change-branch\""),
Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
).
SelectPreviousItem()
t.Views().Main().Content(Contains("-Second Change").Contains("+First Change"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/find_base_commit_for_fixup.go | pkg/integration/tests/commit/find_base_commit_for_fixup.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FindBaseCommitForFixup = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Finds the base commit to create a fixup for",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch").
EmptyCommit("1st commit").
CreateFileAndAdd("file1", "file1 content\n").
Commit("2nd commit").
CreateFileAndAdd("file2", "file2 content\n").
Commit("3rd commit").
UpdateFile("file1", "file1 changed content").
UpdateFile("file2", "file2 changed content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Lines(
Contains("3rd commit"),
Contains("2nd commit"),
Contains("1st commit"),
)
// Two changes from different commits: this fails
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(
MatchesRegexp("Multiple base commits found.*\n\n" +
".*3rd commit\n" +
".*2nd commit"),
).
Confirm()
// Stage only one of the files: this succeeds
t.Views().Files().
IsFocused().
NavigateToLine(Contains("file1")).
PressPrimaryAction().
Press(keys.Files.FindBaseCommitForFixup)
t.Views().Commits().
IsFocused().
Lines(
Contains("3rd commit"),
Contains("2nd commit").IsSelected(),
Contains("1st commit"),
).
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()
// Now only the other file is modified (and unstaged); this works now
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.Views().Commits().
IsFocused().
Lines(
Contains("3rd commit").IsSelected(),
Contains("2nd commit"),
Contains("1st commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/highlight.go | pkg/integration/tests/commit/highlight.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Highlight = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that the commit view highlights the correct lines",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.Log.ShowGraph = "always"
config.GetUserConfig().Gui.AuthorColors = map[string]string{
"CI": "red",
}
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
highlightedColor := "#ffffff"
t.Views().Commits().
DoesNotContainColoredText(highlightedColor, "◯").
Focus().
ContainsColoredText(highlightedColor, "◯")
t.Views().Files().
Focus()
t.Views().Commits().
DoesNotContainColoredText(highlightedColor, "◯")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_switch_to_editor.go | pkg/integration/tests/commit/commit_switch_to_editor.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitSwitchToEditor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit, then switch from built-in commit message panel to editor",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("file1", "file1 content")
shell.CreateFile("file2", "file2 content")
// Set an editor that appends a line to the existing message. Since
// git adds all this "# Please enter the commit message for your changes"
// stuff, this will result in an extra blank line before the added line.
shell.SetConfig("core.editor", "sh -c 'echo third line >>.git/COMMIT_EDITMSG'")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" ?? file1"),
Equals(" ?? file2"),
).
SelectNextItem().
PressPrimaryAction(). // stage one of the files
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("first line").
SwitchToDescription().
Type("second line").
SwitchToSummary().
SwitchToEditor()
t.Views().Commits().
Lines(
Contains("first line"),
)
t.Views().Commits().Focus()
t.Views().Main().Content(MatchesRegexp(`first line\n\s*\n\s*second line\n\s*\n\s*third line`))
// Now check that the preserved commit message was cleared:
t.Views().Files().
Focus().
Lines(
Equals("?? file2"),
).
PressPrimaryAction(). // stage the other file
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals(""))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit.go | pkg/integration/tests/commit/commit.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Commit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" ?? myfile"),
Equals(" ?? myfile2"),
).
SelectNextItem().
PressPrimaryAction(). // stage file
Lines(
Equals("▼ /"),
Equals(" A myfile").IsSelected(),
Equals(" ?? myfile2"),
).
SelectNextItem().
PressPrimaryAction(). // stage other file
Lines(
Equals("▼ /"),
Equals(" A myfile"),
Equals(" A myfile2").IsSelected(),
).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Files().
IsEmpty()
t.Views().Commits().
Focus().
Lines(
Contains(commitMessage).IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /"),
Equals(" A myfile"),
Equals(" A myfile2"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/revert_with_conflict_multiple_commits.go | pkg/integration/tests/commit/revert_with_conflict_multiple_commits.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RevertWithConflictMultipleCommits = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a range of commits, the first of which conflicts",
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")
shell.CreateFileAndAdd("myfile", "first line\n")
shell.Commit("add first line")
shell.UpdateFileAndAdd("myfile", "first line\nsecond line\n")
shell.Commit("add second line")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("CI ◯ add second line").IsSelected(),
Contains("CI ◯ add first line"),
Contains("CI ◯ unrelated change"),
Contains("CI ◯ add empty file"),
).
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 reverts ---"),
Contains("revert").Contains("CI unrelated change"),
Contains("revert").Contains("CI <-- CONFLICT --- add first line"),
Contains("--- Commits ---"),
Contains("CI ◯ add second line"),
Contains("CI ◯ add first line"),
Contains("CI ◯ unrelated change"),
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(`CI ◯ Revert "unrelated change"`),
Contains(`CI ◯ Revert "add first line"`),
Contains("CI ◯ add second line"),
Contains("CI ◯ add first line"),
Contains("CI ◯ unrelated change"),
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/commit/revert.go | pkg/integration/tests/commit/revert.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Revert = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
shell.GitAddAll()
shell.Commit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("first commit"),
).
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("Revert \"first commit\""),
Contains("first commit").IsSelected(),
).
Tap(func() {
t.Views().Main().Content(Contains("+myfile content"))
}).
SelectPreviousItem()
t.Views().Main().Content(Contains("-myfile content"))
t.FileSystem().PathNotPresent("myfile")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/preserve_commit_message.go | pkg/integration/tests/commit/preserve_commit_message.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var PreserveCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Test that the commit message is preserved correctly when canceling the commit message panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("")).
Type("my commit message").
SwitchToDescription().
Type("first paragraph").
AddNewline().
AddNewline().
Type("second paragraph").
Cancel()
t.FileSystem().PathPresent(".git/LAZYGIT_PENDING_COMMIT")
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Content(Equals("my commit message")).
SwitchToDescription().
Content(Equals("first paragraph\n\nsecond paragraph")).
Clear().
SwitchToSummary().
Clear().
Cancel()
t.FileSystem().PathNotPresent(".git/LAZYGIT_PENDING_COMMIT")
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("my new commit message").
Confirm()
t.FileSystem().PathNotPresent(".git/LAZYGIT_PENDING_COMMIT")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_multiline.go | pkg/integration/tests/commit/commit_multiline.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with a multi-line commit message",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("first line").
SwitchToDescription().
AddNewline().
AddNewline().
Type("fourth line").
SwitchToSummary().
Confirm()
t.Views().Commits().
Lines(
Contains("first line"),
)
t.Views().Commits().Focus()
t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*fourth line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/paste_commit_message_over_existing.go | pkg/integration/tests/commit/paste_commit_message_over_existing.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var PasteCommitMessageOverExisting = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Paste a commit message into the commit message panel when there is already text in the panel, causing a confirmation",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > ../clipboard"
config.GetUserConfig().OS.ReadFromClipboardCmd = "cat ../clipboard"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("subject\n\nbody 1st line\nbody 2nd line")
shell.CreateFileAndAdd("file", "file content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
ContainsLines(
Contains("subject").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().Title(Equals("Copy to clipboard")).
Select(Contains("Commit message (subject and body)")).Confirm()
t.ExpectToast(Equals("Commit message copied to clipboard"))
t.Views().Files().
Focus().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("existing message").
OpenCommitMenu()
t.ExpectPopup().Menu().Title(Equals("Commit Menu")).
Select(Contains("Paste commit message from clipboard")).
Confirm()
t.ExpectPopup().Alert().Title(Equals("Paste commit message from clipboard")).
Content(Equals("Pasting will overwrite the current commit message, continue?")).
Confirm()
t.ExpectPopup().CommitMessagePanel().
Content(Equals("subject")).
SwitchToDescription().
Content(Equals("body 1st line\nbody 2nd line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/checkout_file_with_local_modifications.go | pkg/integration/tests/commit/checkout_file_with_local_modifications.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CheckoutFileWithLocalModifications = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a file from a commit that has local modifications",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("dir/file1.txt", "file1\n")
shell.CreateFileAndAdd("dir/file2.txt", "file2\n")
shell.Commit("one")
shell.UpdateFile("dir/file1.txt", "file1\nfile1 change\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("one").IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ dir").IsSelected(),
Equals(" A file1.txt"),
Equals(" A file2.txt"),
).
Press(keys.CommitFiles.CheckoutCommitFile)
t.ExpectPopup().Alert().Title(Equals("Error")).
Content(Contains("local modifications")).
Confirm()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_with_non_matching_branch_name.go | pkg/integration/tests/commit/commit_with_non_matching_branch_name.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWithNonMatchingBranchName = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with defined config commitPrefixes",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{{
Pattern: "^\\w+\\/(\\w+-\\w+).*",
Replace: "[$1]: ",
}}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branchnomatch")
shell.CreateFile("test-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals(""))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/amend.go | pkg/integration/tests/commit/amend.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Amend = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the last commit from the files panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "myfile content\n")
shell.Commit("first commit")
shell.UpdateFileAndAdd("myfile", "myfile content\nmore content\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Lines(
Contains("first commit"),
)
t.Views().Files().
Focus().
Press(keys.Commits.AmendToCommit)
t.ExpectPopup().Confirmation().Title(
Equals("Amend last commit")).
Content(Contains("Are you sure you want to amend last commit?")).
Confirm()
t.Views().Commits().
Focus().
Lines(
Contains("first commit"),
)
t.Views().Main().Content(Contains("+myfile content").Contains("+more content"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_with_fallthrough_prefix.go | pkg/integration/tests/commit/commit_with_fallthrough_prefix.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWithFallthroughPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with multiple CommitPrefixConfig",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{
{Pattern: "^doesntmatch-(\\w+).*", Replace: "[BAD $1]: "},
{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[GOOD $1]: "},
}
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{
"DifferentProject": {{Pattern: "^otherthatdoesn'tmatch-(\\w+).*", Replace: "[BAD $1]: "}},
}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("feature/TEST-001")
shell.CreateFile("test-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[GOOD TEST-001]: ")).
Type("my commit message").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[GOOD TEST-001]: my commit message")).
Type(". Added something else").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("[GOOD TEST-001]: my commit message. Added something else"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/revert_with_conflict_single_commit.go | pkg/integration/tests/commit/revert_with_conflict_single_commit.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RevertWithConflictSingleCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a commit that conflicts",
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")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("CI ◯ add second line").IsSelected(),
Contains("CI ◯ add first line"),
Contains("CI ◯ add empty file"),
).
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")).
Confirm()
}).
Lines(
Contains("--- Pending reverts ---"),
Contains("revert").Contains("CI <-- CONFLICT --- add first line"),
Contains("--- Commits ---"),
Contains("CI ◯ add second line"),
Contains("CI ◯ add first line"),
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(`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 |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/reset_author_range.go | pkg/integration/tests/commit/reset_author_range.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResetAuthorRange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reset author on a range of commits",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.SetConfig("user.email", "Bill@example.com")
shell.SetConfig("user.name", "Bill Smith")
shell.EmptyCommit("fourth")
shell.EmptyCommit("third")
shell.EmptyCommit("second")
shell.EmptyCommit("first")
shell.SetConfig("user.email", "John@example.com")
shell.SetConfig("user.name", "John Smith")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("BS").Contains("first").IsSelected(),
Contains("BS").Contains("second"),
Contains("BS").Contains("third"),
Contains("BS").Contains("fourth"),
).
SelectNextItem().
Press(keys.Universal.ToggleRangeSelect).
SelectNextItem().
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains("Reset author")).
Confirm()
}).
PressEscape().
Lines(
Contains("BS").Contains("first"),
Contains("JS").Contains("second"),
Contains("JS").Contains("third").IsSelected(),
Contains("BS").Contains("fourth"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.