mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
I'm not a skilled UI designer, so I suspect there may be even better options, but it's definitely already better than the raw ASCII "---" we had before. Put the line only at the beginning because it looks bad if the line after the label is misaligned when labels don't have the same width (e.g. "Remote" vs. "Local" in the divergence view).
77 lines
2.2 KiB
Go
77 lines
2.2 KiB
Go
package commit
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var RevertWithConflictSingleCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Reverts a commit that conflicts",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.CreateFileAndAdd("myfile", "")
|
|
shell.Commit("add empty file")
|
|
shell.CreateFileAndAdd("myfile", "first line\n")
|
|
shell.Commit("add first line")
|
|
shell.UpdateFileAndAdd("myfile", "first line\nsecond line\n")
|
|
shell.Commit("add second line")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Commits().
|
|
Focus().
|
|
Lines(
|
|
Contains("CI ○ add second line").IsSelected(),
|
|
Contains("CI ○ add first line"),
|
|
Contains("CI ○ add empty file"),
|
|
).
|
|
SelectNextItem().
|
|
Press(keys.Commits.RevertCommit).
|
|
Tap(func() {
|
|
t.ExpectPopup().Confirmation().
|
|
Title(Equals("Revert commit")).
|
|
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
|
|
Confirm()
|
|
t.ExpectPopup().Menu().
|
|
Title(Equals("Conflicts!")).
|
|
Select(Contains("View conflicts")).
|
|
Confirm()
|
|
}).
|
|
Lines(
|
|
Contains("─── Pending reverts"),
|
|
Contains("revert").Contains("CI <-- CONFLICT --- add first line"),
|
|
Contains("─── Commits"),
|
|
Contains("CI ○ add second line"),
|
|
Contains("CI ○ add first line"),
|
|
Contains("CI ○ add empty file"),
|
|
)
|
|
|
|
t.Views().Options().Content(Contains("View revert options: m"))
|
|
t.Views().Information().Content(Contains("Reverting (Reset)"))
|
|
|
|
t.Views().Files().IsFocused().
|
|
Lines(
|
|
Contains("UU myfile").IsSelected(),
|
|
).
|
|
PressEnter()
|
|
|
|
t.Views().MergeConflicts().IsFocused().
|
|
SelectNextItem().
|
|
PressPrimaryAction()
|
|
|
|
t.ExpectPopup().Alert().
|
|
Title(Equals("Continue")).
|
|
Content(Contains("All merge conflicts resolved. Continue the revert?")).
|
|
Confirm()
|
|
|
|
t.Views().Commits().
|
|
Lines(
|
|
Contains(`CI ○ Revert "add first line"`),
|
|
Contains("CI ○ add second line"),
|
|
Contains("CI ○ add first line"),
|
|
Contains("CI ○ add empty file"),
|
|
)
|
|
},
|
|
})
|