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

Function TestClientCommitsReportsInvalidRef

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

Source from the content-addressed store, hash-verified

478}
479
480func TestClientCommitsReportsInvalidRef(t *testing.T) {
481 // Given a repository without the requested head ref
482 repo := newTestRepo(t)
483 repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit")
484
485 // When commits for the missing ref are requested
486 commits, err := repo.client.Commits(t.Context(), "trunk", "missing")
487
488 // Then Git's invalid revision error is returned
489 require.Error(t, err)
490 var gitError *GitError
491 require.ErrorAs(t, err, &gitError)
492 assert.NotZero(t, gitError.ExitCode)
493 assert.Contains(t, gitError.Stderr, "trunk...missing")
494 assert.Nil(t, commits)
495}
496
497func TestClientLastCommit(t *testing.T) {
498 // Given a repository fixture with two commits

Callers

nothing calls this directly

Calls 5

newTestRepoFunction · 0.85
ContainsMethod · 0.80
CommitsMethod · 0.65
runMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected