MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / TestGetCurrentCommitHash_MatchesHEAD

Function TestGetCurrentCommitHash_MatchesHEAD

vcs/git/git_test.go:120–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func 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
135func TestGetCurrentCommitHash_NoCommits(t *testing.T) {
136 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 5

setupGitRepoFunction · 0.85
createFileFunction · 0.85
gitAddFunction · 0.85
gitCommitAndGetSHAFunction · 0.85
GetCurrentCommitHashFunction · 0.85

Tested by

no test coverage detected