summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorZhen Chen <czhen@google.com>2017-02-15 15:35:20 -0800
committerZhen Chen <czhen@google.com>2017-02-15 15:40:04 -0800
commit87d81a730134186f86797c40934ecdfd9e1e9074 (patch)
treeb6fac24e18bcaa3bd15947acec531c6d69dacb88 /org.eclipse.jgit
parentff852dad518b99edc31e88cbe8c8f45ba207c6a5 (diff)
downloadjgit-87d81a730134186f86797c40934ecdfd9e1e9074.tar.gz
jgit-87d81a730134186f86797c40934ecdfd9e1e9074.zip
Add missing skip garbage pack logic in DfsReader
* Missing garbage pack check in getObjectSize(AnyObjectId, int) * Missing `last` pack check in has(AnyObjectId) and open(AnyObjectId, int) Change-Id: Idd1b9dd8db34c92d7da546fef1936ec9b2728718 Signed-off-by: Zhen Chen <czhen@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
index 3593c6101c..3baf118d4c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
@@ -189,7 +189,9 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
@Override
public boolean has(AnyObjectId objectId) throws IOException {
- if (last != null && last.hasObject(this, objectId))
+ if (last != null
+ && !skipGarbagePack(last)
+ && last.hasObject(this, objectId))
return true;
PackList packList = db.getPackList();
if (hasImpl(packList, objectId)) {
@@ -218,7 +220,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
ObjectLoader ldr;
- if (last != null) {
+ if (last != null && !skipGarbagePack(last)) {
ldr = last.get(this, objectId);
if (ldr != null) {
return checkType(ldr, objectId, typeHint);
@@ -486,7 +488,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
public long getObjectSize(AnyObjectId objectId, int typeHint)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
- if (last != null) {
+ if (last != null && !skipGarbagePack(last)) {
long sz = last.getObjectSize(this, objectId);
if (0 <= sz) {
return sz;
@@ -515,7 +517,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
private long getObjectSizeImpl(PackList packList, AnyObjectId objectId)
throws IOException {
for (DfsPackFile pack : packList.packs) {
- if (pack == last) {
+ if (pack == last || skipGarbagePack(pack)) {
continue;
}
long sz = pack.getObjectSize(this, objectId);