mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-21 04:46:29 +03:00
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>
36 lines
1.0 KiB
Go
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")
|
|
},
|
|
})
|