(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func 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 | |
| 132 | func TestGitShimAllowsReadonlyAccess(t *testing.T) { |
| 133 | tempDir := initGitForPreCommit(t) |
nothing calls this directly
no test coverage detected