(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestClientCurrentBranchReportsDetachedHead(t *testing.T) { |
| 273 | // Given a repository with a detached HEAD |
| 274 | repo := newTestRepo(t) |
| 275 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 276 | repo.run(t, "checkout", "--quiet", "--detach") |
| 277 | |
| 278 | // When the current branch is requested |
| 279 | branch, err := repo.client.CurrentBranch(t.Context()) |
| 280 | |
| 281 | // Then the detached HEAD error is returned |
| 282 | require.Error(t, err) |
| 283 | assert.ErrorIs(t, err, ErrNotOnAnyBranch) |
| 284 | assert.Empty(t, branch) |
| 285 | } |
| 286 | |
| 287 | func TestClientShowRefsReturnsExistingRefsAlongsideMissingRefError(t *testing.T) { |
| 288 | // Given a repository with one requested branch and one missing branch |
nothing calls this directly
no test coverage detected