1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-05-22 10:15:43 +02:00

Add integration test demonstrating whitespace loss in preserved commit messages

Typing a description with leading blank lines, canceling the commit panel, and
reopening it currently drops leading blank lines.
This commit is contained in:
Stefan Haller
2026-04-19 12:08:24 +02:00
parent 4ab36461cb
commit 07a5bb5867
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,42 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var PreserveCommitMessageWhitespace = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Whitespace in the description (e.g. leading blank lines, indented first line) should be preserved when canceling and reopening the commit message panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("my commit message").
SwitchToDescription().
AddNewline().
AddNewline().
Type("body ").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Content(Equals("my commit message")).
SwitchToDescription().
/* EXPECTED:
Content(Equals("\n\nbody ")).
ACTUAL: */
Content(Equals("body")).
Cancel()
},
})
+1
View File
@@ -142,6 +142,7 @@ var tests = []*components.IntegrationTest{
commit.PasteCommitMessage, commit.PasteCommitMessage,
commit.PasteCommitMessageOverExisting, commit.PasteCommitMessageOverExisting,
commit.PreserveCommitMessage, commit.PreserveCommitMessage,
commit.PreserveCommitMessageWhitespace,
commit.ResetAuthor, commit.ResetAuthor,
commit.ResetAuthorRange, commit.ResetAuthorRange,
commit.Revert, commit.Revert,