1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Commit without pre-commit hooks is independent on prefix

Add verify flag

Add and update integration tests

Rename verify to forceSkipHooks

Adapt CommitSkipHooks integration test to actually use a hook

Remove forceSkipHooks param from OnConfirm et al

Simplify tests
This commit is contained in:
Korbinian Schweiger
2025-03-05 20:41:29 +01:00
committed by Stefan Haller
parent ab9f4af636
commit b102646b20
12 changed files with 254 additions and 33 deletions

View File

@ -13,6 +13,9 @@ var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{"repo": {{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}}
},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.NewBranch("feature/TEST-002")
shell.CreateFile("test-wip-commit-prefix", "This is foo bar")
},
@ -20,6 +23,8 @@ var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Commits().
IsEmpty()
checkBlockingHook(t, keys)
t.Views().Files().
IsFocused().
PressPrimaryAction().
@ -27,31 +32,30 @@ var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP")).
Type(" foo").
Type("foo").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP foo")).
InitialText(Equals("foo")).
Type(" bar").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP foo bar")).
InitialText(Equals("foo bar")).
Type(". Added something else").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("WIP foo bar. Added something else"))
t.Views().Main().Content(Contains("foo bar. Added something else"))
},
})