mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
Keep patch-move conflict coverage on the focused diff
Conflict and dirty-worktree handling happen after a custom patch is built, but their tests must no longer rely on either explorer to build it. Select whole and partial patches in the commit diff while preserving the rebase-conflict and stash-restoration assertions. Co-Authored-By: GitHub Copilot <copilot@github.com>
This commit is contained in:
co-authored by
GitHub Copilot
parent
d66a983074
commit
9b0c61db04
+9
-9
@@ -1,15 +1,17 @@
|
||||
package patch_building
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var MoveToIndexFromAddedFileWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a file that was added in a commit to the index, causing a conflict",
|
||||
var MovePatchFromAddedFileToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move part of an added file from a commit to the index, causing a conflict",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("first commit")
|
||||
|
||||
@@ -34,17 +36,15 @@ var MoveToIndexFromAddedFileWithConflict = NewIntegrationTest(NewIntegrationTest
|
||||
Lines(
|
||||
Contains("file1").IsSelected(),
|
||||
).
|
||||
PressEnter()
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
t.Views().PatchBuilding().
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
SelectNextItem().
|
||||
NavigateToLine(Contains("+2nd line")).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Information().Content(Contains("Building patch"))
|
||||
|
||||
t.Common().SelectPatchOption(Contains("Move patch out into index"))
|
||||
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
+12
-5
@@ -1,15 +1,17 @@
|
||||
package patch_building
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
var MovePatchToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index, causing a conflict",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("file1", "file1 content")
|
||||
shell.Commit("first commit")
|
||||
@@ -36,12 +38,17 @@ var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Lines(
|
||||
Contains("file1").IsSelected(),
|
||||
).
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
SelectedLines(Contains("-file1 content")).
|
||||
Press(keys.Universal.ToggleRangeSelect).
|
||||
Press(keys.Universal.NextItem).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Information().Content(Contains("Building patch"))
|
||||
|
||||
t.Common().SelectPatchOption(Contains("Move patch out into index"))
|
||||
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
+15
-10
@@ -1,15 +1,17 @@
|
||||
package patch_building
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var MoveToIndexWithModifiedFile = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index, with a modified file in the working tree that conflicts with the patch",
|
||||
var MovePatchToIndexWithModifiedFile = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index with a conflicting working-tree change",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("file1", "1\n2\n3\n4\n")
|
||||
shell.Commit("first commit")
|
||||
@@ -31,10 +33,16 @@ var MoveToIndexWithModifiedFile = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Lines(
|
||||
Equals("M file1"),
|
||||
).
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
SelectedLines(Contains("-1")).
|
||||
Press(keys.Universal.ToggleRangeSelect).
|
||||
Press(keys.Universal.NextItem).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Information().Content(Contains("Building patch"))
|
||||
|
||||
t.Views().Secondary().Content(Contains("-1\n+11"))
|
||||
|
||||
t.Common().SelectPatchOption(Contains("Move patch out into index"))
|
||||
@@ -49,11 +57,8 @@ var MoveToIndexWithModifiedFile = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Equals("MM file1"),
|
||||
)
|
||||
|
||||
t.Views().Main().
|
||||
Content(Contains("-11\n+111\n"))
|
||||
t.Views().Secondary().
|
||||
Content(Contains("-1\n+11\n"))
|
||||
|
||||
t.Views().Main().Content(Contains("-11\n+111\n"))
|
||||
t.Views().Secondary().Content(Contains("-1\n+11\n"))
|
||||
t.Views().Stash().IsEmpty()
|
||||
},
|
||||
})
|
||||
@@ -413,8 +413,11 @@ var tests = []*components.IntegrationTest{
|
||||
main_view.MoveOnWhenThePatchMarksRewrapTheDiff,
|
||||
main_view.MovePartOfAdjacentAddedLinesToIndex,
|
||||
main_view.MovePartialPatchToIndex,
|
||||
main_view.MovePatchFromAddedFileToIndexWithConflict,
|
||||
main_view.MovePatchToIndex,
|
||||
main_view.MovePatchToIndexWithConflict,
|
||||
main_view.MovePatchToIndexWithCustomDiffConfig,
|
||||
main_view.MovePatchToIndexWithModifiedFile,
|
||||
main_view.NavigateByHunkAndFile,
|
||||
main_view.NoSelectionOverABinaryDiff,
|
||||
main_view.NoSelectionOverACommitLog,
|
||||
@@ -481,9 +484,6 @@ var tests = []*components.IntegrationTest{
|
||||
patch_building.EditLineInPatchBuildingPanel,
|
||||
patch_building.MoveToEarlierCommit,
|
||||
patch_building.MoveToEarlierCommitFromAddedFile,
|
||||
patch_building.MoveToIndexFromAddedFileWithConflict,
|
||||
patch_building.MoveToIndexWithConflict,
|
||||
patch_building.MoveToIndexWithModifiedFile,
|
||||
patch_building.MoveToLaterCommit,
|
||||
patch_building.MoveToLaterCommitPartialHunk,
|
||||
patch_building.MoveToNewCommit,
|
||||
|
||||
Reference in New Issue
Block a user