MCPcopy
hub / github.com/cloudflare/vibesdk / handleGitProtocolRequest

Function handleGitProtocolRequest

worker/api/handlers/git-protocol.ts:325–347  ·  view source on GitHub ↗
(
    request: Request,
    env: Env,
    ctx: ExecutionContext
)

Source from the content-addressed store, hash-verified

323 * Main handler for Git protocol requests
324 */
325export async function handleGitProtocolRequest(
326 request: Request,
327 env: Env,
328 ctx: ExecutionContext
329): Promise<Response> {
330 const url = new URL(request.url);
331 const pathname = url.pathname;
332
333 // Extract app ID
334 const appId = extractAppId(pathname);
335 if (!appId) {
336 return new Response('Invalid Git URL', { status: 400 });
337 }
338
339 // Route to appropriate handler
340 if (GIT_INFO_REFS_PATTERN.test(pathname)) {
341 return handleInfoRefs(request, env, ctx, appId);
342 } else if (GIT_UPLOAD_PACK_PATTERN.test(pathname)) {
343 return handleUploadPack(request, env, ctx, appId);
344 }
345
346 return new Response('Not found', { status: 404 });
347}

Callers 1

fetchFunction · 0.90

Calls 3

extractAppIdFunction · 0.85
handleInfoRefsFunction · 0.85
handleUploadPackFunction · 0.85

Tested by

no test coverage detected