(t *testing.T)
| 1204 | } |
| 1205 | |
| 1206 | func TestClientFetchUpdatesRemoteTrackingBranchInModifiedRepoDir(t *testing.T) { |
| 1207 | // Given a local remote with a trunk commit and a separate destination repository |
| 1208 | source := newTestRepo(t) |
| 1209 | remote := newBareTestRepo(t) |
| 1210 | wantHead := source.commit(t, "remote commit") |
| 1211 | source.run(t, "remote", "add", "origin", remote.fileURL()) |
| 1212 | source.run(t, "push", "--quiet", "origin", "trunk") |
| 1213 | destination := newTestRepo(t) |
| 1214 | destination.run(t, "remote", "add", "origin", remote.fileURL()) |
| 1215 | client := &Client{} |
| 1216 | |
| 1217 | // When trunk is fetched using a repository-directory modifier |
| 1218 | err := client.Fetch(t.Context(), "origin", "trunk", WithRepoDir(destination.dir)) |
| 1219 | |
| 1220 | // Then the destination remote-tracking branch points at the remote commit |
| 1221 | require.NoError(t, err) |
| 1222 | assert.Equal(t, wantHead, destination.run(t, "rev-parse", "refs/remotes/origin/trunk")) |
| 1223 | } |
| 1224 | |
| 1225 | func TestClientFetchReportsMissingRef(t *testing.T) { |
| 1226 | // Given a repository connected to an empty local remote |
nothing calls this directly
no test coverage detected