MCPcopy Create free account
hub / github.com/dirk/quickhook / initGitForPreCommit

Function initGitForPreCommit

hooks/pre_commit_test.go:17–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func initGitForPreCommit(t *testing.T) test.TempDir {
18 tempDir := test.NewTempDir(t, 1)
19 tempDir.RequireExec("git", "init", "--initial-branch=main", "--quiet", ".")
20 tempDir.RequireExec("git", "config", "--local", "user.name", "example")
21 tempDir.RequireExec("git", "config", "--local", "user.email", "example@example.com")
22 tempDir.WriteFile([]string{"example.txt"}, "Changed!")
23 tempDir.RequireExec("git", "add", "example.txt")
24 return tempDir
25}
26
27func TestFailingHookWithoutPty(t *testing.T) {
28 tempDir := initGitForPreCommit(t)

Calls 3

RequireExecMethod · 0.95
WriteFileMethod · 0.95
NewTempDirFunction · 0.92

Tested by

no test coverage detected