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

Function TestClientRemotePushDefaultPropagatesGitError

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

Source from the content-addressed store, hash-verified

785}
786
787func TestClientRemotePushDefaultPropagatesGitError(t *testing.T) {
788 // Given a client whose repository directory no longer exists
789 repo := newTestRepo(t)
790 require.NoError(t, os.RemoveAll(repo.dir))
791
792 // When remote.pushDefault is read
793 remote, err := repo.client.RemotePushDefault(t.Context())
794
795 // Then the repository error is preserved
796 require.Error(t, err)
797 var gitError *GitError
798 require.ErrorAs(t, err, &gitError)
799 assert.Equal(t, 128, gitError.ExitCode)
800 assert.Empty(t, remote)
801}
802
803func TestClientPushRevisionReturnsPushRemoteTrackingRef(t *testing.T) {
804 // Given a branch that fetches from upstream but pushes to origin

Callers

nothing calls this directly

Calls 5

newTestRepoFunction · 0.85
EqualMethod · 0.80
EmptyMethod · 0.80
RemotePushDefaultMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected