Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
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"), Equals(" A file3"), ) }, })
View Source
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() t.Views().Files(). IsEmpty() }, })
View Source
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() t.Views().MergeConflicts(). IsFocused(). SelectedLines( Contains("<<<<<<< HEAD"), Contains("First Change"), Contains("======="), ). PressPrimaryAction() t.Common().ContinueOnConflictsResolved() }, })
View Source
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(). Lines( Equals("▼ /"), Equals(" UU file1").IsSelected(), Equals(" UU file2"), ). PressPrimaryAction(). Lines( Equals("UU file2").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Cannot stage/unstage directory containing files with inline merge conflicts.")). Confirm() }). PressEnter() t.Views().MergeConflicts(). IsFocused(). SelectedLines( Contains("<<<<<<< HEAD"), Contains("First Change"), Contains("======="), ). PressPrimaryAction() t.Views().Files(). IsFocused(). Lines( Equals("UU file2").IsSelected(), ). PressPrimaryAction(). Lines( Equals("A file3").IsSelected(), ) }, })
View Source
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`) 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"`) 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")) }, })
View Source
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?")). Cancel() t.Views().Files(). Focus(). Lines( Contains("M file").IsSelected(), ) t.Views().Main().Content(Contains("-a1\n+a2\n").DoesNotContain("-no eol")) }, })
View Source
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")). SelectedLines( Contains("<<<<<<< HEAD"), Contains("First Change"), Contains("======="), ). PressPrimaryAction(). Content(DoesNotContain("<<<<<<< HEAD\nFirst Change")). Press(keys.Universal.Undo). Content(Contains("<<<<<<< HEAD\nFirst Change")) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.