public void AdvertiseUploadPack(Stream output) { using (var repository = GetRepository()) { var pack = new UploadPack(repository); pack.sendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(new PacketLineOut(output))); } }
private static void HandleInfoRefsGet(HttpContext context, GitRoute route) { var gitService = context.Request.QueryString["service"]; if (string.IsNullOrWhiteSpace(gitService) || !gitService.StartsWith("git-")) { SendFile(context, route, "text/plain; charset=utf-8"); } else { var service = gitService.Substring(4); context.Response.ContentType = string.Format("application/x-git-{0}-advertisement", service); context.Response.Write(GitString("# service=git-" + service + "\n")); context.Response.Write("0000"); if (service == "upload-pack") { var pack = new UploadPack(route.Repository); pack.sendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(new PacketLineOut(context.Response.OutputStream))); } else if (service == "receive-pack") { VerifyAccess(context); var pack = new ReceivePack(route.Repository); pack.SendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(new PacketLineOut(context.Response.OutputStream))); } } }