]> source.dussan.org Git - jgit.git/commitdiff
ReceivePack: enable capabilities immediately on first line 50/76650/1
authorShawn Pearce <spearce@spearce.org>
Tue, 5 Jul 2016 19:37:26 +0000 (12:37 -0700)
committerShawn Pearce <spearce@spearce.org>
Tue, 5 Jul 2016 19:37:26 +0000 (12:37 -0700)
Instead of deferring until after command parsing, enable the
capabilities after the first pkt-line has been read from the client.
This allows the server to setup the side-band-64k channel immediately.

Change-Id: I141b7fc92e983a41d3a58da8e1464a6917422b6c

org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

index c4f662be9d7f400a8920d5ce723ec983162a0314..6df2a4c6f6dba71f646aebea534fb84d4523be77 100644 (file)
@@ -1077,7 +1077,7 @@ public abstract class BaseReceivePack {
         */
        protected void recvCommands() throws IOException {
                PushCertificateParser certParser = getPushCertificateParser();
-               FirstLine firstLine = null;
+               boolean firstPkt = true;
                try {
                        for (;;) {
                                String line;
@@ -1097,10 +1097,12 @@ public abstract class BaseReceivePack {
                                        continue;
                                }
 
-                               if (firstLine == null) {
-                                       firstLine = new FirstLine(line);
+                               if (firstPkt) {
+                                       firstPkt = false;
+                                       FirstLine firstLine = new FirstLine(line);
                                        enabledCapabilities = firstLine.getCapabilities();
                                        line = firstLine.getLine();
+                                       enableCapabilities();
 
                                        if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) {
                                                certParser.receiveHeader(pckIn, !isBiDirectionalPipe());
index 1dd58d0d76420963d5234764379d3ad529a06371..2477806bd989c7f2b3fb8a451643e79255bb14c1 100644 (file)
@@ -184,8 +184,6 @@ public class ReceivePack extends BaseReceivePack {
                        return;
                recvCommands();
                if (hasCommands()) {
-                       enableCapabilities();
-
                        Throwable unpackError = null;
                        if (needPack()) {
                                try {