Fix lastModified to be consistent in DfsGarbageCollector

Set all packs written by the DfsGarbageCollector to use the same
starting timestamp as lastModified. This makes it easier to see
which packs came from the same DfsGarbageCollector run, as they
share the same timestamp.

Change-Id: Id633573fbc3f0f360887b4745cacf33d6fc09320
This commit is contained in:
Shawn Pearce 2016-06-26 11:18:59 -07:00
parent 30eb6423a2
commit d8603446a2
1 changed files with 3 additions and 1 deletions

View File

@ -95,8 +95,8 @@ public class DfsGarbageCollector {
private long coalesceGarbageLimit = 50 << 20;
private long startTimeMillis;
private List<DfsPackFile> packsBefore;
private Set<ObjectId> allHeads;
private Set<ObjectId> nonHeads;
private Set<ObjectId> txnHeads;
@ -190,6 +190,7 @@ public boolean pack(ProgressMonitor pm) throws IOException {
throw new IllegalStateException(
JGitText.get().supportOnlyPackIndexVersion2);
startTimeMillis = System.currentTimeMillis();
ctx = (DfsReader) objdb.newReader();
try {
refdb.refresh();
@ -422,6 +423,7 @@ private DfsPackDescription writePack(PackSource source, PackWriter pw,
PackStatistics stats = pw.getStatistics();
pack.setPackStats(stats);
pack.setLastModified(startTimeMillis);
newPackStats.add(stats);
newPackObj.add(pw.getObjectSet());