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 538e69a17..f6e4c2391 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 @@ -495,10 +495,24 @@ public abstract class DfsObjDatabase extends ObjectDatabase { /** All known packs, sorted. */ public final DfsPackFile[] packs; + private long lastModified = -1; + PackList(DfsPackFile[] packs) { this.packs = packs; } + /** @return last modified time of all packs, in milliseconds. */ + public long getLastModified() { + if (lastModified < 0) { + long max = 0; + for (DfsPackFile pack : packs) { + max = Math.max(max, pack.getPackDescription().getLastModified()); + } + lastModified = max; + } + return lastModified; + } + abstract boolean dirty(); /**