From f15e9c088a6c50d96789fbeba04bb3272a5d3d4d Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 Aug 2016 11:51:40 -0700 Subject: [PATCH] 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 --- .../jgit/internal/storage/dfs/DfsObjDatabase.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 @@ -67,6 +67,11 @@ public abstract class DfsObjDatabase extends ObjectDatabase { return true; } + @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. @@ -537,6 +545,11 @@ public abstract class DfsObjDatabase extends ObjectDatabase { return dirty; } + @Override + void clearDirty() { + dirty = false; + } + @Override public void markDirty() { dirty = true; -- 2.39.5