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

Function TestIsAncestor_False

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

Source from the content-addressed store, hash-verified

356}
357
358func TestIsAncestor_False(t *testing.T) {
359 tmpDir := t.TempDir()
360 setupGitRepo(t, tmpDir)
361
362 // Create first commit
363 createFile(t, tmpDir, "first.txt", "content")
364 gitAdd(t, tmpDir, "first.txt")
365 firstCommit := gitCommitAndGetSHA(t, tmpDir, "First commit")
366
367 // Create second commit
368 createFile(t, tmpDir, "second.txt", "content")
369 gitAdd(t, tmpDir, "second.txt")
370 secondCommit := gitCommitAndGetSHA(t, tmpDir, "Second commit")
371
372 // Second should NOT be ancestor of first
373 result, err := isAncestor(tmpDir, secondCommit, firstCommit)
374
375 require.NoError(t, err)
376 assert.False(t, result)
377}
378
379func TestIsAncestor_SameCommit(t *testing.T) {
380 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