Files
lazygit/pkg/integration/tests/commit/cancel_commit_during_squash_merge.go
Stefan HallerandClaude Opus 5.5 09780de32e Use the squash merge message when committing a squash merge
After "Squash merge and leave uncommitted", the commit panel opens
empty, or with the commit prefix of the branch. Users have to type a
message for the squash merge themselves. "git commit" from the terminal
suggests the message in SQUASH_MSG instead.

Show the message in SQUASH_MSG in the commit panel, unless there is a
preserved message. It takes precedence over the commit prefix, like the
message of "Squash merge and commit" does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:36:41 +01:00

36 lines
1.0 KiB
Go

package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CancelCommitDuringSquashMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open the commit panel during a squash merge started outside lazygit, and close it without changing git's message",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one").
NewBranch("feature-branch").
CreateFileAndAdd("feature-file", "content").
Commit("feature").
Checkout("master").
RunCommand([]string{"git", "merge", "--squash", "feature-branch"})
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
Lines(
Equals("A feature-file"),
).
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("Squashed commit of the following:")).
Cancel()
t.FileSystem().PathNotPresent(".git/LAZYGIT_PENDING_COMMIT")
},
})