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

Function TestHandlesDeletedFiles

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

Source from the content-addressed store, hash-verified

114}
115
116func TestHandlesDeletedFiles(t *testing.T) {
117 tempDir := initGitForPreCommit(t)
118 tempDir.MkdirAll(".quickhook", "pre-commit")
119 tempDir.WriteFile([]string{".quickhook", "pre-commit", "passes"}, "#!/bin/sh \n echo \"passed\"")
120 tempDir.RequireExec("git", "commit", "--message", "Commit example.txt", "--quiet", "--no-verify")
121 tempDir.RequireExec("git", "rm", "example.txt", "--quiet")
122 tempDir.WriteFile(
123 []string{"other-example.txt"},
124 "Also changed!")
125 tempDir.RequireExec("git", "add", "other-example.txt")
126
127 output, err := tempDir.ExecQuickhook("hook", "pre-commit")
128 assert.NoError(t, err)
129 assert.Equal(t, "", output)
130}
131
132func TestGitShimAllowsReadonlyAccess(t *testing.T) {
133 tempDir := initGitForPreCommit(t)

Callers

nothing calls this directly

Calls 5

initGitForPreCommitFunction · 0.85
MkdirAllMethod · 0.80
WriteFileMethod · 0.80
RequireExecMethod · 0.80
ExecQuickhookMethod · 0.80

Tested by

no test coverage detected