1
0
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:
Stefan Haller
2026-01-16 08:33:33 +01:00
parent 0339b414d9
commit b41bb8f845
2 changed files with 47 additions and 0 deletions

View File

@@ -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()
},
})

View File

@@ -130,6 +130,7 @@ var tests = []*components.IntegrationTest{
commit.DoNotShowBranchMarkerForHeadCommit,
commit.FailHooksThenCommitNoHooks,
commit.FindBaseCommitForFixup,
commit.FindBaseCommitForFixupDisregardFixupsForSameBaseCommit,
commit.FindBaseCommitForFixupDisregardMainBranch,
commit.FindBaseCommitForFixupOnlyAddedLines,
commit.FindBaseCommitForFixupWarningForAddedLines,