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:
committed by
Stefan Haller
parent
ab9f4af636
commit
b102646b20
44
pkg/integration/tests/commit/commit_skip_hooks.go
Normal file
44
pkg/integration/tests/commit/commit_skip_hooks.go
Normal file
@ -0,0 +1,44 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var blockingHook = `#!/bin/bash
|
||||
|
||||
# For this test all we need is a hook that always fails
|
||||
exit 1
|
||||
`
|
||||
|
||||
var CommitSkipHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Commit with skip hook using CommitChangesWithoutHook",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
|
||||
shell.MakeExecutable(".git/hooks/pre-commit")
|
||||
|
||||
shell.CreateFile("file.txt", "content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
checkBlockingHook(t, keys)
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
PressPrimaryAction().
|
||||
Lines(
|
||||
Equals("A file.txt"),
|
||||
).
|
||||
Press(keys.Files.CommitChangesWithoutHook)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Title(Equals("Commit summary")).
|
||||
Type("foo bar").
|
||||
Confirm()
|
||||
|
||||
t.Views().Commits().Focus()
|
||||
t.Views().Main().Content(Contains("foo bar"))
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user