Browse Source

Skip first pack if avoid garbage is set and it is a garbage pack

At beginning of the OBJECT_SCAN loop, it will first check if the object
exists in the last pack, however, it forgot to avoid garbage pack for
the first iteration.

Change-Id: I8a99c0f439218d19c49cd4dae891b8cc4a57099d
Signed-off-by: Zhen Chen <czhen@google.com>
stable-4.7
Zhen Chen 8 years ago
parent
commit
ff852dad51
  1. 18
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java

18
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java

@ -332,15 +332,17 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
OBJECT_SCAN: for (Iterator<T> it = pending.iterator(); it.hasNext();) { OBJECT_SCAN: for (Iterator<T> it = pending.iterator(); it.hasNext();) {
T t = it.next(); T t = it.next();
try { if (!skipGarbagePack(lastPack)) {
long p = lastPack.findOffset(this, t); try {
if (0 < p) { long p = lastPack.findOffset(this, t);
r.add(new FoundObject<T>(t, lastIdx, lastPack, p)); if (0 < p) {
it.remove(); r.add(new FoundObject<T>(t, lastIdx, lastPack, p));
continue; it.remove();
continue;
}
} catch (IOException e) {
// Fall though and try to examine other packs.
} }
} catch (IOException e) {
// Fall though and try to examine other packs.
} }
for (int i = 0; i < packs.length; i++) { for (int i = 0; i < packs.length; i++) {

Loading…
Cancel
Save