(repo: string)
| 120 | } |
| 121 | |
| 122 | export async function addRemote(repo: string): Promise<never | void> { |
| 123 | const { stderr } = await exec({ command: `git remote add ${gitOrigin} ${repo} && git fetch ${gitOrigin}` }) |
| 124 | if (stderr) { |
| 125 | const alreadyExists = stderr.match(`${gitOrigin} already exists.`) |
| 126 | const successfulNewBranch = stderr.match('new branch') |
| 127 | |
| 128 | // validate the response is acceptable |
| 129 | if (!alreadyExists && !successfulNewBranch) { |
| 130 | logger(`Error: ${stderr}`) |
| 131 | throw new Error('Error adding git remote') |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | export async function checkRemoteExists(): Promise<boolean> { |
| 137 | try { |
no test coverage detected