Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce2016-08-19 18:51:40 +0000
committerShawn Pearce2016-08-19 19:06:03 +0000
commitf15e9c088a6c50d96789fbeba04bb3272a5d3d4d (patch)
treeb5baef1cb0b789fe452867ad1ddfb8287f3250b6
parent13f0db25f272e29b607c5b0e01a3b0d612731794 (diff)
downloadjgit-f15e9c088a6c50d96789fbeba04bb3272a5d3d4d.tar.gz
jgit-f15e9c088a6c50d96789fbeba04bb3272a5d3d4d.tar.xz
jgit-f15e9c088a6c50d96789fbeba04bb3272a5d3d4d.zip
DfsObjDatabase: clear PackList dirty bit if no new packs
If a reference was updated more recently than a pack was written (typical) the PackList was perpetually dirty until the next GC was completed for the repository. Detect this condition by observing no changes to the PackList membership and resetting the dirty bit. Change-Id: Ie2133aca1f8083307c73b6a26358175864f100ef
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
index f6e4c2391a..b1d6c0dd19 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
@@ -68,6 +68,11 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
}
@Override
+ void clearDirty() {
+ // Always dirty.
+ }
+
+ @Override
public void markDirty() {
// Always dirty.
}
@@ -443,8 +448,10 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
p.close();
if (list.isEmpty())
return new PackListImpl(NO_PACKS.packs);
- if (!foundNew)
+ if (!foundNew) {
+ old.clearDirty();
return old;
+ }
return new PackListImpl(list.toArray(new DfsPackFile[list.size()]));
}
@@ -514,6 +521,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
}
abstract boolean dirty();
+ abstract void clearDirty();
/**
* Mark pack list as dirty.
@@ -538,6 +546,11 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
}
@Override
+ void clearDirty() {
+ dirty = false;
+ }
+
+ @Override
public void markDirty() {
dirty = true;
}

Back to the top