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

Function TestClientRemoteURLSeparatesRemoteNameFromOptions

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

Source from the content-addressed store, hash-verified

1767}
1768
1769func TestClientRemoteURLSeparatesRemoteNameFromOptions(t *testing.T) {
1770 // Given a configured remote whose name resembles a Git option
1771 repo := newTestRepo(t)
1772 repo.run(t, "config", "remote.--upload-pack=malicious.url", "https://example.com/repo.git")
1773
1774 // When the remote URL is requested
1775 remoteURL, err := repo.client.RemoteURL(t.Context(), "--upload-pack=malicious")
1776
1777 // Then an option separator protects the remote name
1778 require.NoError(t, err)
1779 assert.Equal(t, "https://example.com/repo.git", remoteURL)
1780}
1781
1782func TestClientRemoteURLReportsMissingGitExecutable(t *testing.T) {
1783 // Given Git cannot be resolved

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
RemoteURLMethod · 0.80
EqualMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected