(t *testing.T)
| 1029 | } |
| 1030 | |
| 1031 | func TestClientCheckoutNewBranchTracksRemoteBranch(t *testing.T) { |
| 1032 | // Given a repository with an origin feature tracking ref |
| 1033 | repo := newTestRepo(t) |
| 1034 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 1035 | repo.run(t, "remote", "add", "origin", filepath.Join(t.TempDir(), "remote.git")) |
| 1036 | repo.run(t, "update-ref", "refs/remotes/origin/feature", "HEAD") |
| 1037 | |
| 1038 | // When a local branch is created from that tracking ref |
| 1039 | err := repo.client.CheckoutNewBranch(t.Context(), "origin", "feature") |
| 1040 | |
| 1041 | // Then the new branch is current and tracks origin |
| 1042 | require.NoError(t, err) |
| 1043 | assert.Equal(t, "feature", repo.run(t, "branch", "--show-current")) |
| 1044 | assert.Equal(t, "origin", repo.run(t, "config", "branch.feature.remote")) |
| 1045 | assert.Equal(t, "refs/heads/feature", repo.run(t, "config", "branch.feature.merge")) |
| 1046 | } |
| 1047 | |
| 1048 | func TestClientCheckoutNewBranchReportsMissingTrackingBranch(t *testing.T) { |
| 1049 | // Given a repository without the requested remote tracking branch |
nothing calls this directly
no test coverage detected