(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func TestFetchBranches(t *testing.T) { |
| 310 | t.Run("silently skips branches that do not exist on the remote", func(t *testing.T) { |
| 311 | remote, local := setupRemoteAndClone(t) |
| 312 | |
| 313 | // Add a new branch on the remote with a commit. |
| 314 | require.NoError(t, execGit(remote, "checkout", "-b", "feature")) |
| 315 | createCommit(t, remote, "f.txt", "f", "feature commit") |
| 316 | require.NoError(t, execGit(remote, "checkout", "main")) |
| 317 | |
| 318 | err := FetchBranches(context.Background(), local, "feature", "does-not-exist") |
| 319 | require.NoError(t, err, "missing branch must not produce an error") |
| 320 | |
| 321 | // The existing branch must have been fetched. |
| 322 | hash, err := Hash(context.Background(), local, "refs/remotes/origin/feature") |
| 323 | require.NoError(t, err) |
| 324 | require.NotEmpty(t, hash) |
| 325 | }) |
| 326 | } |
| 327 | |
| 328 | func TestHash(t *testing.T) { |
| 329 | t.Run("returns ErrRefNotFound for a missing ref", func(t *testing.T) { |
nothing calls this directly
no test coverage detected