mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +02:00
Add a test demonstrating the problem
When pressing `e` on line 5 in a diff of an older commit, we expect it to take us to line 5 in that file. But we end up on line 2, because the file had further changes both in newer commits, and in the unstaged changes of the working copy.
This commit is contained in:
parent
49ca7f6a84
commit
1c5fe8ff17
@ -0,0 +1,50 @@
|
||||
package patch_building
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var EditLineInPatchBuildingPanel = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Edit a line in the patch building panel; make sure we end up on the right line",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.EditAtLine = "echo {{filename}}:{{line}} > edit-command"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("file.txt", "4\n5\n6\n")
|
||||
shell.Commit("01")
|
||||
shell.UpdateFileAndAdd("file.txt", "1\n2a\n2b\n3\n4\n5\n6\n")
|
||||
shell.Commit("02")
|
||||
shell.UpdateFile("file.txt", "1\n2\n3\n4\n5\n6\n")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("02").IsSelected(),
|
||||
Contains("01"),
|
||||
).
|
||||
Press(keys.Universal.NextItem).
|
||||
PressEnter()
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("A file.txt").IsSelected(),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().PatchBuilding().
|
||||
IsFocused().
|
||||
Content(Contains("+4\n+5\n+6")).
|
||||
NavigateToLine(Contains("+5")).
|
||||
Press(keys.Universal.Edit)
|
||||
|
||||
/* EXPECTED:
|
||||
t.FileSystem().FileContent("edit-command", Contains("file.txt:5\n"))
|
||||
ACTUAL: */
|
||||
t.FileSystem().FileContent("edit-command", Contains("file.txt:2\n"))
|
||||
},
|
||||
})
|
@ -257,6 +257,7 @@ var tests = []*components.IntegrationTest{
|
||||
patch_building.Apply,
|
||||
patch_building.ApplyInReverse,
|
||||
patch_building.ApplyInReverseWithConflict,
|
||||
patch_building.EditLineInPatchBuildingPanel,
|
||||
patch_building.MoveRangeToIndex,
|
||||
patch_building.MoveToEarlierCommit,
|
||||
patch_building.MoveToEarlierCommitFromAddedFile,
|
||||
|
Loading…
x
Reference in New Issue
Block a user