summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDave Borowitz2011-12-13 14:00:19 (EST)
committer Dave Borowitz2011-12-13 14:04:30 (EST)
commit84c80be1dc45885969e2d0fa0421f709b8706453 (patch)
treeebd28a353e0c8dd2347e98e57f016efa0b90728b
parent9f661377161c9abeea2354411a1349a5806b281b (diff)
downloadjgit-84c80be1dc45885969e2d0fa0421f709b8706453.zip
jgit-84c80be1dc45885969e2d0fa0421f709b8706453.tar.gz
jgit-84c80be1dc45885969e2d0fa0421f709b8706453.tar.bz2
Fire DfsPacksChangedEvents when committing packs.refs/changes/07/4807/2
Once a pack has been committed with commitPack(), we know that the pack list has changed but we don't re-scan the underlying storage. Change-Id: Ia7b35df4442a5f5dfe7e817edcc77b44b5410d08
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java24
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java2
2 files changed, 24 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java
index 286616e..b1290d9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java
@@ -198,6 +198,10 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
* During pack compaction or GC the new pack file may be replacing other
* older files. Implementations should remove those older files (if any) as
* part of the commit of the new file.
+ * <p>
+ * This method is a trivial wrapper around
+ * {@link #commitPackImpl(Collection, Collection)} that calls the
+ * implementation and fires events.
*
* @param desc
* description of the new packs.
@@ -207,7 +211,25 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
* the packs cannot be committed. On failure a rollback must
* also be attempted by the caller.
*/
- protected abstract void commitPack(Collection<DfsPackDescription> desc,
+ protected void commitPack(Collection<DfsPackDescription> desc,
+ Collection<DfsPackDescription> replaces) throws IOException {
+ commitPackImpl(desc, replaces);
+ getRepository().fireEvent(new DfsPacksChangedEvent());
+ }
+
+ /**
+ * Implementation of pack commit.
+ *
+ * @see #commitPack(Collection, Collection)
+ *
+ * @param desc
+ * description of the new packs.
+ * @param replaces
+ * if not null, list of packs to remove.
+ * @throws IOException
+ * the packs cannot be committed.
+ */
+ protected abstract void commitPackImpl(Collection<DfsPackDescription> desc,
Collection<DfsPackDescription> replaces) throws IOException;
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java
index 635e68c..966b518 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java
@@ -79,7 +79,7 @@ public class InMemoryRepository extends DfsRepository {
}
@Override
- protected synchronized void commitPack(
+ protected synchronized void commitPackImpl(
Collection<DfsPackDescription> desc,
Collection<DfsPackDescription> replace) {
List<DfsPackDescription> n;