(t *testing.T)
| 478 | } |
| 479 | |
| 480 | func TestClientCommitsReportsInvalidRef(t *testing.T) { |
| 481 | // Given a repository without the requested head ref |
| 482 | repo := newTestRepo(t) |
| 483 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 484 | |
| 485 | // When commits for the missing ref are requested |
| 486 | commits, err := repo.client.Commits(t.Context(), "trunk", "missing") |
| 487 | |
| 488 | // Then Git's invalid revision error is returned |
| 489 | require.Error(t, err) |
| 490 | var gitError *GitError |
| 491 | require.ErrorAs(t, err, &gitError) |
| 492 | assert.NotZero(t, gitError.ExitCode) |
| 493 | assert.Contains(t, gitError.Stderr, "trunk...missing") |
| 494 | assert.Nil(t, commits) |
| 495 | } |
| 496 | |
| 497 | func TestClientLastCommit(t *testing.T) { |
| 498 | // Given a repository fixture with two commits |
nothing calls this directly
no test coverage detected