mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-01-26 01:41:35 +03:00
Add a test that documents the current behavior
Currently we get an annoying error message, but we'd like the base commit to be selected, disregarding the fixup.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var FindBaseCommitForFixupDisregardFixupsForSameBaseCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Finds the base commit to create a fixup for, disregarding fixup commits for the same base commit",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("1st commit").
|
||||
NewBranch("mybranch").
|
||||
CreateFileAndAdd("file1", "1\n2\n3\n").
|
||||
Commit("2nd commit").
|
||||
UpdateFileAndAdd("file1", "1\n2\n3a\n").
|
||||
Commit("fixup! 2nd commit").
|
||||
EmptyCommit("3rd commit").
|
||||
UpdateFileAndAdd("file1", "1a\n2\n3b\n")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("3rd commit").IsSelected(),
|
||||
Contains("fixup! 2nd commit"),
|
||||
Contains("2nd commit"),
|
||||
Contains("1st commit"),
|
||||
)
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Press(keys.Files.FindBaseCommitForFixup)
|
||||
|
||||
t.ExpectPopup().Alert().
|
||||
Title(Equals("Error")).
|
||||
Content(
|
||||
MatchesRegexp("Multiple base commits found.*\n\n" +
|
||||
".*fixup! 2nd commit\n" +
|
||||
".*2nd commit"),
|
||||
).
|
||||
Confirm()
|
||||
},
|
||||
})
|
||||
@@ -130,6 +130,7 @@ var tests = []*components.IntegrationTest{
|
||||
commit.DoNotShowBranchMarkerForHeadCommit,
|
||||
commit.FailHooksThenCommitNoHooks,
|
||||
commit.FindBaseCommitForFixup,
|
||||
commit.FindBaseCommitForFixupDisregardFixupsForSameBaseCommit,
|
||||
commit.FindBaseCommitForFixupDisregardMainBranch,
|
||||
commit.FindBaseCommitForFixupOnlyAddedLines,
|
||||
commit.FindBaseCommitForFixupWarningForAddedLines,
|
||||
|
||||
Reference in New Issue
Block a user