MCPcopy Index your code
hub / github.com/coderoad/coderoad-vscode / checkRemoteConnects

Function checkRemoteConnects

src/services/git/index.ts:105–120  ·  view source on GitHub ↗
(repo: TT.TutorialRepo)

Source from the content-addressed store, hash-verified

103}
104
105export async function checkRemoteConnects(repo: TT.TutorialRepo): Promise<never | void> {
106 // check for git repo
107 const externalRepoExists = await exec({ command: `git ls-remote --exit-code --heads ${repo.uri}` })
108 if (externalRepoExists.stderr) {
109 // no repo found or no internet connection
110 throw new Error(externalRepoExists.stderr)
111 }
112 // check for git repo branch
113 const { stderr, stdout } = await exec({ command: `git ls-remote --exit-code --heads ${repo.uri} ${repo.branch}` })
114 if (stderr) {
115 throw new Error(stderr)
116 }
117 if (!stdout || !stdout.length) {
118 throw new Error('Tutorial branch does not exist')
119 }
120}
121
122export async function addRemote(repo: string): Promise<never | void> {
123 const { stderr } = await exec({ command: `git remote add ${gitOrigin} ${repo} && git fetch ${gitOrigin}` })

Callers

nothing calls this directly

Calls 1

execFunction · 0.90

Tested by

no test coverage detected