private void serviceV2() throws IOException { if (biDirectionalPipe) { // Just like in service(), the capability advertisement // is sent only if this is a bidirectional pipe. (If // not, the client is expected to call // sendAdvertisedRefs() on its own.) protocolV2Hook .onCapabilities(CapabilitiesV2Request.builder().build()); for (String s : getV2CapabilityAdvertisement()) { pckOut.writeString(s + "\n"); //$NON-NLS-1$ } pckOut.end(); while (!serveOneCommandV2()) { // Repeat until an empty command or EOF. } return; } try { serveOneCommandV2(); } finally { while (0 < rawIn.skip(2048) || 0 <= rawIn.read()) { // Discard until EOF. } rawOut.stopBuffering(); } }
rawOut.stopBuffering(); protocolV2Hook.onFetch(req);
private void lsRefsV2() throws IOException { ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig); LsRefsV2Request req = parser.parseLsRefsRequest(pckIn); protocolV2Hook.onLsRefs(req); rawOut.stopBuffering(); PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); adv.setUseProtocolV2(true); if (req.getPeel()) { adv.setDerefTags(true); } Map<String, Ref> refsToSend = getFilteredRefs(req.getRefPrefixes()); if (req.getSymrefs()) { findSymrefs(adv, refsToSend); } adv.send(refsToSend); adv.end(); }
.onCapabilities(CapabilitiesV2Request.builder().build()); for (String s : getV2CapabilityAdvertisement()) { adv.writeOne(s);
private void lsRefsV2() throws IOException { ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig); LsRefsV2Request req = parser.parseLsRefsRequest(pckIn); protocolV2Hook.onLsRefs(req); rawOut.stopBuffering(); PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); adv.setUseProtocolV2(true); if (req.getPeel()) { adv.setDerefTags(true); } Map<String, Ref> refsToSend; if (req.getRefPrefixes().isEmpty()) { refsToSend = getAdvertisedOrDefaultRefs(); } else { refsToSend = new HashMap<>(); String[] prefixes = req.getRefPrefixes().toArray(new String[0]); for (Ref ref : db.getRefDatabase().getRefsByPrefix(prefixes)) { refsToSend.put(ref.getName(), ref); } } if (req.getSymrefs()) { findSymrefs(adv, refsToSend); } adv.send(refsToSend); adv.end(); }
rawOut.stopBuffering(); protocolV2Hook.onFetch(req);
private void serviceV2() throws IOException { if (biDirectionalPipe) { // Just like in service(), the capability advertisement // is sent only if this is a bidirectional pipe. (If // not, the client is expected to call // sendAdvertisedRefs() on its own.) protocolV2Hook .onCapabilities(CapabilitiesV2Request.builder().build()); for (String s : getV2CapabilityAdvertisement()) { pckOut.writeString(s + "\n"); //$NON-NLS-1$ } pckOut.end(); while (!serveOneCommandV2()) { // Repeat until an empty command or EOF. } return; } try { serveOneCommandV2(); } finally { while (0 < rawIn.skip(2048) || 0 <= rawIn.read()) { // Discard until EOF. } rawOut.stopBuffering(); } }
.onCapabilities(CapabilitiesV2Request.builder().build()); for (String s : getV2CapabilityAdvertisement()) { adv.writeOne(s);