1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-10 04:07:18 +02:00
lazygit/pkg/integration/tests/interactive_rebase/shared.go
Stefan Haller 3928d0ebda Insert fake todo entry for a conflicting commit that is being applied
When stopping in a rebase because of a conflict, it is nice to see the commit
that git is trying to apply. Create a fake todo entry labelled "conflict" for
this, and show the "<-- YOU ARE HERE ---" string for that one (in red) instead
of for the real current head.
2023-06-22 18:57:58 +02:00

76 lines
1.4 KiB
Go

package interactive_rebase
import (
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
func handleConflictsFromSwap(t *TestDriver) {
t.Common().AcknowledgeConflicts()
t.Views().Commits().
Lines(
Contains("pick").Contains("commit two"),
Contains("conflict").Contains("<-- YOU ARE HERE --- commit three"),
Contains("commit one"),
)
t.Views().Files().
IsFocused().
Lines(
Contains("UU myfile"),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
TopLines(
Contains("<<<<<<< HEAD"),
Contains("one"),
Contains("======="),
Contains("three"),
Contains(">>>>>>>"),
).
SelectNextItem().
PressPrimaryAction() // pick "three"
t.Common().ContinueOnConflictsResolved()
t.Common().AcknowledgeConflicts()
t.Views().Files().
IsFocused().
Lines(
Contains("UU myfile"),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
TopLines(
Contains("<<<<<<< HEAD"),
Contains("three"),
Contains("======="),
Contains("two"),
Contains(">>>>>>>"),
).
SelectNextItem().
PressPrimaryAction() // pick "two"
t.Common().ContinueOnConflictsResolved()
t.Views().Commits().
Focus().
Lines(
Contains("commit two").IsSelected(),
Contains("commit three"),
Contains("commit one"),
).
Tap(func() {
t.Views().Main().Content(Contains("-three").Contains("+two"))
}).
SelectNextItem().
Tap(func() {
t.Views().Main().Content(Contains("-one").Contains("+three"))
})
}