(t *testing.T)
| 118 | } |
| 119 | |
| 120 | func TestGetCurrentCommitHash_MatchesHEAD(t *testing.T) { |
| 121 | tmpDir := t.TempDir() |
| 122 | setupGitRepo(t, tmpDir) |
| 123 | |
| 124 | createFile(t, tmpDir, "test.txt", "content") |
| 125 | gitAdd(t, tmpDir, "test.txt") |
| 126 | expectedHash := gitCommitAndGetSHA(t, tmpDir, "Initial commit") |
| 127 | |
| 128 | hash, err := GetCurrentCommitHash(tmpDir) |
| 129 | |
| 130 | require.NoError(t, err) |
| 131 | // The current hash should be a prefix of the full commit SHA |
| 132 | assert.True(t, strings.HasPrefix(expectedHash, hash), "current hash should match HEAD") |
| 133 | } |
| 134 | |
| 135 | func TestGetCurrentCommitHash_NoCommits(t *testing.T) { |
| 136 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected