Source:
<code>FetchV0Request recvWants(PacketLineIn pckIn) throws PackProtocolException, IOException { FetchV0Request.Builder reqBuilder = new FetchV0Request.Builder(); boolean isFirst = true; boolean filterReceived = false; for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (isFirst) { break; } throw eof; } if (line == PacketLineIn.END) { break; } if (line.startsWith("deepen ")) { int depth = Integer.parseInt(line.substring(7)); if (depth <= 0) { throw new PackProtocolException( MessageFormat.format(JGitText.get().invalidDepth, Integer.valueOf(depth))); } reqBuilder.setDepth(depth); continue; } if (line.startsWith("shallow ")) { reqBuilder.addClientShallowCommit( ObjectId.fromString(line.substring(8))); continue; } if (transferConfig.isAllowFilter() && line.startsWith(OPTION_FILTER + " ")) { String arg = line.substring(OPTION_FILTER.length() + 1); if (filterReceived) { throw new PackProtocolException( JGitText.get().tooManyFilters); } filterReceived = true; <START> reqBuilder.setFilterSpec(ProtocolV2Parser.parseFilterLine(arg)); <END> continue; } if (!line.startsWith("want ") || line.length() < 45) { throw new PackProtocolException(MessageFormat .format(JGitText.get().expectedGot, "want", line)); } if (isFirst) { if (line.length() > 45) { FirstWant firstLine = FirstWant.fromLine(line); reqBuilder.addClientCapabilities(firstLine.getCapabilities()); reqBuilder.setAgent(firstLine.getAgent()); line = firstLine.getLine(); } } reqBuilder.addWantId(ObjectId.fromString(line.substring(5))); isFirst = false; } return reqBuilder.build(); }</code><technical_language>this helper move out of protocol v2 specific code? E.g. a static method in FilterSpec class (e.g. FilterSpec.fromFilterLine(arg))</technical_language>

Target:
FetchV0Request recvWants(PacketLineIn pckIn) throws PackProtocolException, IOException { FetchV0Request.Builder reqBuilder = new FetchV0Request.Builder(); boolean isFirst = true; boolean filterReceived = false; for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (isFirst) { break; } throw eof; } if (line == PacketLineIn.END) { break; } if (line.startsWith("deepen ")) { int depth = Integer.parseInt(line.substring(7)); if (depth <= 0) { throw new PackProtocolException( MessageFormat.format(JGitText.get().invalidDepth, Integer.valueOf(depth))); } reqBuilder.setDepth(depth); continue; } if (line.startsWith("shallow ")) { reqBuilder.addClientShallowCommit( ObjectId.fromString(line.substring(8))); continue; } if (transferConfig.isAllowFilter() && line.startsWith(OPTION_FILTER + " ")) { String arg = line.substring(OPTION_FILTER.length() + 1); if (filterReceived) { throw new PackProtocolException( JGitText.get().tooManyFilters); } filterReceived = true; reqBuilder.setFilterSpec(FilterSpec.parseFilterLine(arg)); continue; } if (!line.startsWith("want ") || line.length() < 45) { throw new PackProtocolException(MessageFormat .format(JGitText.get().expectedGot, "want", line)); } if (isFirst) { if (line.length() > 45) { FirstWant firstLine = FirstWant.fromLine(line); reqBuilder.addClientCapabilities(firstLine.getCapabilities()); reqBuilder.setAgent(firstLine.getAgent()); line = firstLine.getLine(); } } reqBuilder.addWantId(ObjectId.fromString(line.substring(5))); isFirst = false; } return reqBuilder.build(); }