mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
Expose the missing whole-file semantics in the focused diff
The patch-building panel could move an added file as a file, while selecting every visible change through the focused diff currently moves only its content and leaves the empty file behind. Keep the intended index state beside the current one so the replacement flow demonstrates that gap before it is fixed. Co-Authored-By: GitHub Copilot <copilot@github.com>
This commit is contained in:
co-authored by
GitHub Copilot
parent
bdbdd4286e
commit
6b30b3941d
+19
-26
@@ -1,11 +1,11 @@
|
||||
package patch_building
|
||||
package main_view
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
var MovePatchToIndex = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
@@ -30,39 +30,32 @@ var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("file1"),
|
||||
Contains("file2"),
|
||||
).
|
||||
SelectNextItem().
|
||||
Press(keys.Universal.FocusMainView)
|
||||
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
SelectedLines(Contains("+file1 content")).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Information().Content(Contains("Building patch"))
|
||||
|
||||
t.Views().Secondary().Content(Contains("+file1 content"))
|
||||
|
||||
t.Common().SelectPatchOption(Contains("Move patch out into index"))
|
||||
|
||||
t.Views().Files().
|
||||
Lines(
|
||||
Contains("A").Contains("file1"),
|
||||
)
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("file2").IsSelected(),
|
||||
).
|
||||
PressEscape()
|
||||
|
||||
t.Views().Files().Lines(
|
||||
/* EXPECTED:
|
||||
Contains("A").Contains("file1"),
|
||||
ACTUAL: */
|
||||
Contains("M").Contains("file1"),
|
||||
)
|
||||
t.Views().Main().
|
||||
IsFocused().
|
||||
Content(Contains("+file2 content"))
|
||||
t.Views().Commits().Lines(
|
||||
Contains("first commit").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("first commit").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Files().
|
||||
Focus()
|
||||
|
||||
t.Views().Secondary().
|
||||
Content(Contains("file1 content"))
|
||||
t.Views().Files().Focus()
|
||||
t.Views().Secondary().Content(Contains("file1 content"))
|
||||
},
|
||||
})
|
||||
@@ -410,6 +410,7 @@ var tests = []*components.IntegrationTest{
|
||||
main_view.KeepSelectionAfterMovingPatchOut,
|
||||
main_view.KeepSelectionVisibleWhenDiffShrinks,
|
||||
main_view.MoveOnWhenThePatchMarksRewrapTheDiff,
|
||||
main_view.MovePatchToIndex,
|
||||
main_view.NavigateByHunkAndFile,
|
||||
main_view.NoSelectionOverABinaryDiff,
|
||||
main_view.NoSelectionOverACommitLog,
|
||||
@@ -477,7 +478,6 @@ var tests = []*components.IntegrationTest{
|
||||
patch_building.MoveRangeToIndex,
|
||||
patch_building.MoveToEarlierCommit,
|
||||
patch_building.MoveToEarlierCommitFromAddedFile,
|
||||
patch_building.MoveToIndex,
|
||||
patch_building.MoveToIndexFromAddedFileWithConflict,
|
||||
patch_building.MoveToIndexPartOfAdjacentAddedLines,
|
||||
patch_building.MoveToIndexPartial,
|
||||
|
||||
Reference in New Issue
Block a user