diff options
author | Matthew DeVore <matvore@gmail.com> | 2019-03-18 09:45:59 -0700 |
---|---|---|
committer | Matthew DeVore <matvore@gmail.com> | 2019-03-22 16:06:22 -0700 |
commit | 4cd954856eb8bdbe651338e7a1e3a61dd13d4fa2 (patch) | |
tree | 68095cc1fcea9a85418c2dfcecf0a5c6006abd31 /org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java | |
parent | cc9ca71a166914969b795aeb887a882aa53a2fec (diff) | |
download | jgit-4cd954856eb8bdbe651338e7a1e3a61dd13d4fa2.tar.gz jgit-4cd954856eb8bdbe651338e7a1e3a61dd13d4fa2.zip |
Expose and pass around the FilterSpec object rather than the raw blob limit
Use the FilterSpec object so that less code has to know about the make-up of
FilterSpecs. When fields are added to FilterSpec, these pieces of code won't
need updating again.
Change-Id: I2b9e59a9926ff112faf62a3fa2d33c961a1779e5
Signed-off-by: Matthew DeVore <matvore@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index d54ae10f69..a729445309 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -245,8 +245,12 @@ public abstract class BasePackFetchConnection extends BasePackConnection private PacketLineOut pckState; - /** If not -1, the maximum blob size to be sent to the server. */ - private final long filterBlobLimit; + /** + * Either FilterSpec.NO_FILTER for a filter that doesn't filter + * anything, or a filter that indicates what and what not to send to the + * server. + */ + private final FilterSpec filterSpec; /** * Create a new connection to fetch using the native git transport. @@ -268,7 +272,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection includeTags = transport.getTagOpt() != TagOpt.NO_TAGS; thinPack = transport.isFetchThin(); - filterBlobLimit = transport.getFilterBlobLimit(); + filterSpec = transport.getFilterSpec(); if (local != null) { walk = new RevWalk(local); @@ -521,10 +525,8 @@ public abstract class BasePackFetchConnection extends BasePackConnection if (first) { return false; } - if (filterBlobLimit == 0) { - p.writeString(OPTION_FILTER + " blob:none"); //$NON-NLS-1$ - } else if (filterBlobLimit > 0) { - p.writeString(OPTION_FILTER + " blob:limit=" + filterBlobLimit); //$NON-NLS-1$ + if (!filterSpec.isNoOp()) { + p.writeString(filterSpec.filterLine()); } p.end(); outNeedsEnd = false; @@ -566,7 +568,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection OPTION_MULTI_ACK_DETAILED)); } - if (filterBlobLimit >= 0 && !wantCapability(line, OPTION_FILTER)) { + if (!filterSpec.isNoOp() && !wantCapability(line, OPTION_FILTER)) { throw new PackProtocolException(uri, JGitText.get().filterRequiresCapability); } |