MCPcopy
hub / github.com/cli/cli / stubGitRemote

Function stubGitRemote

pkg/cmd/skills/publish/publish_test.go:30–40  ·  view source on GitHub ↗

stubGitRemote registers CommandStubber stubs for git remote detection.

(cs *run.CommandStubber, remoteURLs map[string]string)

Source from the content-addressed store, hash-verified

28
29// stubGitRemote registers CommandStubber stubs for git remote detection.
30func stubGitRemote(cs *run.CommandStubber, remoteURLs map[string]string) {
31 var remoteLines string
32 for name, url := range remoteURLs {
33 remoteLines += fmt.Sprintf("%[1]s\t%[2]s (fetch)\n%[1]s\t%[2]s (push)\n", name, url)
34 }
35 cs.Register(`git( .+)? remote -v`, 0, remoteLines)
36 cs.Register(`git( .+)? config --get-regexp \^remote\\\.`, 1, "")
37 for name, url := range remoteURLs {
38 cs.Register(fmt.Sprintf(`git( .+)? remote get-url -- %s`, regexp.QuoteMeta(name)), 0, url+"\n")
39 }
40}
41
42// stubEnsurePushed registers stubs for ensurePushed + runPublishRelease CurrentBranch calls.
43func stubEnsurePushed(cs *run.CommandStubber, branch string) {

Calls 1

RegisterMethod · 0.45

Tested by

no test coverage detected