diff options
author | Dave Borowitz <dborowitz@google.com> | 2016-07-19 13:05:27 -0400 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2016-07-19 13:18:13 -0400 |
commit | ecb2aa05030529b7ecdfe9ff4b7a3effce0a6821 (patch) | |
tree | eefd7fadce4df35dcd27816476a34dc0c13e079c /org.eclipse.jgit | |
parent | e790ec3fb17e176d645dc9171baab4ea4172f11f (diff) | |
download | jgit-ecb2aa05030529b7ecdfe9ff4b7a3effce0a6821.tar.gz jgit-ecb2aa05030529b7ecdfe9ff4b7a3effce0a6821.zip |
DfsObjDatabase: Add lazy last modified method to PackList
Change-Id: Id045f162fa584ea14da29a9df58a42c53a78dc15
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java | 14 |
1 files changed, 14 insertions, 0 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 538e69a177..f6e4c2391a 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(); /** |