diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2018-07-12 10:58:28 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2018-07-20 17:09:05 -0700 |
commit | 32798dcfdb00662a640f0ff2915766591d21e287 (patch) | |
tree | 2b6df8a68f59f75d11d67c95ff8daf6d05740e85 /org.eclipse.jgit | |
parent | fb9031c9566308794f888695cafd108f19d835be (diff) | |
download | jgit-32798dcfdb00662a640f0ff2915766591d21e287.tar.gz jgit-32798dcfdb00662a640f0ff2915766591d21e287.zip |
Always send refs' objects despite "filter" in pack
In a0c9016abd ("upload-pack: send refs' objects despite "filter"",
2018-07-09), Git updated the "filter" option in the fetch-pack
upload-pack protocol to not filter objects explicitly specified in
"want" lines, even if they match the criterion of the filter. Update
JGit to match that behavior.
Change-Id: Ia4d74326edb89e61062e397e05483298c50f9232
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 36d6f0aebc..24af8a73ba 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -1970,7 +1970,7 @@ public class PackWriter implements AutoCloseable { byte[] pathBuf = walker.getPathBuffer(); int pathLen = walker.getPathLength(); bases.addBase(o.getType(), pathBuf, pathLen, pathHash); - filterAndAddObject(o, o.getType(), pathHash); + filterAndAddObject(o, o.getType(), pathHash, want); countingMonitor.update(1); } } else { @@ -1980,7 +1980,7 @@ public class PackWriter implements AutoCloseable { continue; if (exclude(o)) continue; - filterAndAddObject(o, o.getType(), walker.getPathHashCode()); + filterAndAddObject(o, o.getType(), walker.getPathHashCode(), want); countingMonitor.update(1); } } @@ -2013,7 +2013,7 @@ public class PackWriter implements AutoCloseable { needBitmap.remove(objectId); continue; } - filterAndAddObject(objectId, obj.getType(), 0); + filterAndAddObject(objectId, obj.getType(), 0, want); } if (thin) @@ -2075,12 +2075,14 @@ public class PackWriter implements AutoCloseable { // Adds the given object as an object to be packed, first performing // filtering on blobs at or exceeding a given size. private void filterAndAddObject(@NonNull AnyObjectId src, int type, - int pathHashCode) throws IOException { + int pathHashCode, @NonNull Set<? extends AnyObjectId> want) + throws IOException { // Check if this object needs to be rejected, doing the cheaper // checks first. boolean reject = filterBlobLimit >= 0 && type == OBJ_BLOB && + !want.contains(src) && reader.getObjectSize(src, OBJ_BLOB) > filterBlobLimit; if (!reject) { addObject(src, type, pathHashCode); |