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

Function TestClientPullUsesAuthenticatedFastForwardOnlyCommand

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

Source from the content-addressed store, hash-verified

1306}
1307
1308func TestClientPullUsesAuthenticatedFastForwardOnlyCommand(t *testing.T) {
1309 // Given a client that records the Git command
1310 var gotArgs []string
1311 client := Client{GitPath: "path/to/git"}
1312
1313 // When a remote branch is pulled
1314 err := client.Pull(t.Context(), "origin", "trunk", recordCommandArgs(t, &gotArgs))
1315
1316 // Then Git clears existing helpers, scopes gh credentials, and requires a fast-forward
1317 require.NoError(t, err)
1318 assert.Equal(t, []string{"path/to/git", "-c", "credential.helper=", "-c", `credential.helper=!"gh" auth git-credential`, "pull", "--ff-only", "origin", "trunk"}, gotArgs)
1319}
1320
1321func TestClientPushCreatesRemoteBranchAndUpstream(t *testing.T) {
1322 // Given a local trunk branch, an empty remote, and a client defaulting to a different repository

Callers

nothing calls this directly

Calls 3

PullMethod · 0.95
recordCommandArgsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected