diff options
author | Shawn Pearce <spearce@spearce.org> | 2013-08-07 15:43:58 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2013-08-07 15:44:02 -0700 |
commit | 15adcefb73a48ee11ec1b231a2ebf8c18e15e53f (patch) | |
tree | 6d0b634393cc9c2eae1f0ca7c4f52bdda1f26e52 | |
parent | ef7512b596e59785fe01a2513d49284c6ceb7587 (diff) | |
download | jgit-15adcefb73a48ee11ec1b231a2ebf8c18e15e53f.tar.gz jgit-15adcefb73a48ee11ec1b231a2ebf8c18e15e53f.zip |
Allow UploadPack requests with no options
UploadPack can be invoked with no capabilities selected by the
client if the client is an ancient version of Git that nobody in
their right mind should still be using. Or if the client is very
broken and does not want to use any of the newer features added to
the protocol since its inception.
Change-Id: I3baa6f90e6a41a37a8eab8449a3cc41f4efcb91a
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 836376ce11..f0ee974177 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -868,10 +868,13 @@ public class UploadPack { if (!line.startsWith("want ") || line.length() < 45) //$NON-NLS-1$ throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$ - if (isFirst && line.length() > 45) { - final FirstLine firstLine = new FirstLine(line); - options = firstLine.getOptions(); - line = firstLine.getLine(); + if (isFirst) { + if (line.length() > 45) { + FirstLine firstLine = new FirstLine(line); + options = firstLine.getOptions(); + line = firstLine.getLine(); + } else + options = Collections.emptySet(); } wantIds.add(ObjectId.fromString(line.substring(5))); |