MCPcopy Create free account
hub / github.com/cli/cli / TestClientFetchUpdatesRemoteTrackingBranchInModifiedRepoDir

Function TestClientFetchUpdatesRemoteTrackingBranchInModifiedRepoDir

git/client_test.go:1206–1223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1204}
1205
1206func 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
1225func TestClientFetchReportsMissingRef(t *testing.T) {
1226 // Given a repository connected to an empty local remote

Callers

nothing calls this directly

Calls 8

FetchMethod · 0.95
newTestRepoFunction · 0.85
newBareTestRepoFunction · 0.85
WithRepoDirFunction · 0.85
commitMethod · 0.80
fileURLMethod · 0.80
EqualMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected