diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 5a61edd6a..0724eac70 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -1171,6 +1171,9 @@ protected void recvCommands() throws IOException { } } pushCert = certParser.build(); + if (hasCommands()) { + readPostCommands(pckIn); + } } catch (PackProtocolException e) { if (sideBand) { try { @@ -1217,6 +1220,16 @@ static ReceiveCommand parseCommand(String line) throws PackProtocolException { return new ReceiveCommand(oldId, newId, name); } + /** + * @param in + * request stream. + * @throws IOException + * request line cannot be read. + */ + void readPostCommands(PacketLineIn in) throws IOException { + // Do nothing by default. + } + /** Enable capabilities based on a previously read capabilities line. */ protected void enableCapabilities() { sideBand = isCapabilityEnabled(CAPABILITY_SIDE_BAND_64K); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 2e3d74a14..cc20d50a7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -220,14 +220,17 @@ protected void enableCapabilities() { super.enableCapabilities(); } - private void readPushOptions() throws IOException { - pushOptions = new ArrayList<>(4); - for (;;) { - String option = pckIn.readString(); - if (option == PacketLineIn.END) { - break; + @Override + void readPostCommands(PacketLineIn in) throws IOException { + if (usePushOptions) { + pushOptions = new ArrayList<>(4); + for (;;) { + String option = in.readString(); + if (option == PacketLineIn.END) { + break; + } + pushOptions.add(option); } - pushOptions.add(option); } } @@ -241,10 +244,6 @@ private void service() throws IOException { return; recvCommands(); if (hasCommands()) { - if (usePushOptions) { - readPushOptions(); - } - Throwable unpackError = null; if (needPack()) { try {