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

Function TestIsAncestor_True

vcs/git/git_test.go:337–356  ·  view source on GitHub ↗

Tests for isAncestor

(t *testing.T)

Source from the content-addressed store, hash-verified

335// Tests for isAncestor
336
337func TestIsAncestor_True(t *testing.T) {
338 tmpDir := t.TempDir()
339 setupGitRepo(t, tmpDir)
340
341 // Create first commit
342 createFile(t, tmpDir, "first.txt", "content")
343 gitAdd(t, tmpDir, "first.txt")
344 firstCommit := gitCommitAndGetSHA(t, tmpDir, "First commit")
345
346 // Create second commit
347 createFile(t, tmpDir, "second.txt", "content")
348 gitAdd(t, tmpDir, "second.txt")
349 secondCommit := gitCommitAndGetSHA(t, tmpDir, "Second commit")
350
351 // First should be ancestor of second
352 result, err := isAncestor(tmpDir, firstCommit, secondCommit)
353
354 require.NoError(t, err)
355 assert.True(t, result)
356}
357
358func TestIsAncestor_False(t *testing.T) {
359 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 5

setupGitRepoFunction · 0.85
createFileFunction · 0.85
gitAddFunction · 0.85
gitCommitAndGetSHAFunction · 0.85
isAncestorFunction · 0.85

Tested by

no test coverage detected