aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-08 12:30:47 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-08 13:04:38 +0200
commit718555518ded4fbcafe0c1203f0035d3251884e6 (patch)
tree3e49529cd0ebc21fcea581efe0fa15fdcdc8b81c /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm
parentfcfe1299c37ae8308e9d930201823b3ac340dd2b (diff)
parent0046b2a8fefcbfecc10a7b198a075eb2775d3e7a (diff)
downloadjgit-718555518ded4fbcafe0c1203f0035d3251884e6.tar.gz
jgit-718555518ded4fbcafe0c1203f0035d3251884e6.zip
Merge branch 'stable-5.2' into stable-5.3
* stable-5.2: Fix OpenSshConfigTest#config FileSnapshot: fix bug with timestamp thresholding In LockFile#waitForStatChange wait in units of file time resolution Cache FileStoreAttributeCache per directory Fix FileSnapshot#save(long) and FileSnapshot#save(Instant) Persist minimal racy threshold and allow manual configuration Measure minimum racy interval to auto-configure FileSnapshot Reuse FileUtils to recursively delete files created by tests Fix FileAttributeCache.toString() Add test for racy git detection in FileSnapshot Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit Add missing javadoc in org.eclipse.jgit.junit Enhance RepeatRule to report number of failures at the end Fix FileSnapshotTests for filesystem with high timestamp resolution Retry deleting test files in FileBasedConfigTest Measure filesystem timestamp resolution already in test setup Refactor FileSnapshotTest to use NIO APIs Measure stored timestamp resolution instead of time to touch file Handle CancellationException in FileStoreAttributeCache Fix FileSnapshot#saveNoConfig Use Instant for smudge time in DirCache and DirCacheEntry Use Instant instead of milliseconds for filesystem timestamp handling Workaround SecurityException in FS#getFsTimestampResolution Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution FS: ignore AccessDeniedException when measuring timestamp resolution Add debug trace for FileSnapshot Use FileChannel.open to touch file and set mtime to now Persist filesystem timestamp resolution and allow manual configuration Increase bazel timeout for long running tests Bazel: Fix lint warning flagged by buildifier Update bazlets to latest version Bazel: Add missing dependencies for ArchiveCommandTest Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file Add support for nanoseconds and microseconds for Config#getTimeUnit Optionally measure filesystem timestamp resolution asynchronously Delete unused FileTreeIteratorWithTimeControl FileSnapshot#equals: consider UNKNOWN_SIZE Timeout measuring file timestamp resolution after 2 seconds Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8 Fix non-deterministic hash of archives created by ArchiveCommand Update Maven plugins ecj, plexus, error-prone Update Maven plugins and cleanup Maven warnings Make inner classes static where possible Fix API problem filters Change-Id: I238adfd3080a5fed9d64c3c757297da6ea893918 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
index 7f99d76bda..14a60a3b46 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
@@ -48,8 +48,10 @@ package org.eclipse.jgit.pgm.debug;
import static java.lang.Integer.valueOf;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheEntry;
@@ -67,25 +69,27 @@ class ShowDirCache extends TextBuiltin {
/** {@inheritDoc} */
@Override
protected void run() throws Exception {
- final SimpleDateFormat fmt;
- fmt = new SimpleDateFormat("yyyy-MM-dd,HH:mm:ss.SSS"); //$NON-NLS-1$
+ final DateTimeFormatter fmt = DateTimeFormatter
+ .ofPattern("yyyy-MM-dd,HH:mm:ss.nnnnnnnnn") //$NON-NLS-1$
+ .withLocale(Locale.getDefault())
+ .withZone(ZoneId.systemDefault());
final DirCache cache = db.readDirCache();
for (int i = 0; i < cache.getEntryCount(); i++) {
final DirCacheEntry ent = cache.getEntry(i);
final FileMode mode = FileMode.fromBits(ent.getRawMode());
final int len = ent.getLength();
- long lastModified = ent.getLastModified();
- final Date mtime = new Date(lastModified);
+ Instant mtime = ent.getLastModifiedInstant();
final int stage = ent.getStage();
outw.print(mode);
outw.format(" %6d", valueOf(len)); //$NON-NLS-1$
outw.print(' ');
- if (millis)
- outw.print(lastModified);
- else
+ if (millis) {
+ outw.print(mtime.toEpochMilli());
+ } else {
outw.print(fmt.format(mtime));
+ }
outw.print(' ');
outw.print(ent.getObjectId().name());
outw.print(' ');