stubGitRemote registers CommandStubber stubs for git remote detection.
(cs *run.CommandStubber, remoteURLs map[string]string)
| 28 | |
| 29 | // stubGitRemote registers CommandStubber stubs for git remote detection. |
| 30 | func 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. |
| 43 | func stubEnsurePushed(cs *run.CommandStubber, branch string) { |
no test coverage detected