Tests for isAncestor
(t *testing.T)
| 335 | // Tests for isAncestor |
| 336 | |
| 337 | func 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 | |
| 358 | func TestIsAncestor_False(t *testing.T) { |
| 359 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected