MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / isUrlAValidGitRepo

Function isUrlAValidGitRepo

packages/backend/src/git.ts:275–285  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

273}
274
275export const isUrlAValidGitRepo = async (url: string) => {
276 const git = simpleGit();
277
278 // List the remote heads. If an exception is thrown, the URL is not a valid git repo.
279 try {
280 const result = await git.listRemote(['--heads', url]);
281 return result.trim().length > 0;
282 } catch (error: unknown) {
283 return false;
284 }
285}
286
287export const getOriginUrl = async (path: string) => {
288 const git = createGitClientForPath(path);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected