mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
Add test demonstrating problem with revert (or cherry-pick) during a rebase
This problem can't happen inside of lazygit itself right now, but this will change in the future. It will only happen when you stopped in an interactive rebase on an "edit" entry, and then you perform a revert or cherry-pick consisting of more than one commit; in this situation lazygit will show a conflict although there is none. This is not possible with lazygit yet, as we don't support range-select for reverting, and we don't use `git cherry-pick` for cherry-picking. Both will change in the future, so it's good to fix this bug.
This commit is contained in:
parent
6b6d881624
commit
9b88052a4e
2 changed files with 68 additions and 0 deletions
|
@ -0,0 +1,67 @@
|
|||
package interactive_rebase
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var RevertDuringRebaseWhenStoppedOnEdit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Revert a series of commits while stopped in a rebase",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
// TODO: use our revert UI once we support range-select for reverts
|
||||
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
|
||||
{
|
||||
Key: "X",
|
||||
Context: "commits",
|
||||
Command: "git -c core.editor=: revert HEAD^ HEAD^^",
|
||||
},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("master commit")
|
||||
shell.NewBranch("branch")
|
||||
shell.CreateNCommits(4)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit 04").IsSelected(),
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
Contains("master commit"),
|
||||
).
|
||||
NavigateToLine(Contains("commit 03")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
Contains("pick").Contains("commit 04"),
|
||||
Contains("<-- YOU ARE HERE --- commit 03").IsSelected(),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
Contains("master commit"),
|
||||
).
|
||||
Press("X").
|
||||
Lines(
|
||||
/* EXPECTED:
|
||||
Contains("pick").Contains("commit 04"),
|
||||
Contains(`<-- YOU ARE HERE --- Revert "commit 01"`).IsSelected(),
|
||||
Contains(`Revert "commit 02"`),
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
Contains("master commit"),
|
||||
ACTUAL: */
|
||||
Contains("pick").Contains("commit 04"),
|
||||
Contains("edit").Contains("<-- CONFLICT --- commit 03").IsSelected(),
|
||||
Contains(`Revert "commit 01"`),
|
||||
Contains(`Revert "commit 02"`),
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
Contains("master commit"),
|
||||
)
|
||||
},
|
||||
})
|
|
@ -264,6 +264,7 @@ var tests = []*components.IntegrationTest{
|
|||
interactive_rebase.QuickStartKeepSelectionRange,
|
||||
interactive_rebase.Rebase,
|
||||
interactive_rebase.RebaseWithCommitThatBecomesEmpty,
|
||||
interactive_rebase.RevertDuringRebaseWhenStoppedOnEdit,
|
||||
interactive_rebase.RevertMultipleCommitsInInteractiveRebase,
|
||||
interactive_rebase.RevertSingleCommitInInteractiveRebase,
|
||||
interactive_rebase.RewordCommitWithEditorAndFail,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue