(t *testing.T)
| 285 | } |
| 286 | |
| 287 | func TestClientShowRefsReturnsExistingRefsAlongsideMissingRefError(t *testing.T) { |
| 288 | // Given a repository with one requested branch and one missing branch |
| 289 | repo := newTestRepo(t) |
| 290 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 291 | wantHash := repo.run(t, "rev-parse", "HEAD") |
| 292 | |
| 293 | // When both refs are resolved |
| 294 | refs, err := repo.client.ShowRefs(t.Context(), []string{"refs/heads/trunk", "refs/heads/missing"}) |
| 295 | |
| 296 | // Then the existing ref and the semantic Git error are both returned |
| 297 | require.Error(t, err) |
| 298 | var gitError *GitError |
| 299 | require.ErrorAs(t, err, &gitError) |
| 300 | assert.NotZero(t, gitError.ExitCode) |
| 301 | assert.Equal(t, []Ref{{Hash: wantHash, Name: "refs/heads/trunk"}}, refs) |
| 302 | } |
| 303 | |
| 304 | func TestClientShowRefsSeparatesRefsFromOptions(t *testing.T) { |
| 305 | // Given a repository with one branch |
nothing calls this directly
no test coverage detected