summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java13
1 files changed, 12 insertions, 1 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 ea6bd3a91e..f70ead9294 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -958,6 +958,7 @@ public class UploadPack {
}
boolean includeTag = false;
+ boolean filterReceived = false;
while ((line = pckIn.readString()) != PacketLineIn.END) {
if (line.startsWith("want ")) { //$NON-NLS-1$
wantIds.add(ObjectId.fromString(line.substring(5)));
@@ -1014,6 +1015,13 @@ public class UploadPack {
throw new PackProtocolException(
JGitText.get().deepenSinceWithDeepen);
}
+ } else if (transferConfig.isAllowFilter()
+ && line.startsWith(OPTION_FILTER + ' ')) {
+ if (filterReceived) {
+ throw new PackProtocolException(JGitText.get().tooManyFilters);
+ }
+ filterReceived = true;
+ parseFilter(line.substring(OPTION_FILTER.length() + 1));
} else {
throw new PackProtocolException(MessageFormat
.format(JGitText.get().unexpectedPacketLine, line));
@@ -1113,7 +1121,10 @@ public class UploadPack {
ArrayList<String> caps = new ArrayList<>();
caps.add("version 2"); //$NON-NLS-1$
caps.add(COMMAND_LS_REFS);
- caps.add(COMMAND_FETCH + '=' + OPTION_SHALLOW);
+ caps.add(
+ COMMAND_FETCH + '=' +
+ (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + //$NON-NLS-1$
+ OPTION_SHALLOW);
return caps;
}