diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 14:12:57 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 14:32:02 +0200 |
commit | 3cea3676c75127dd720ea4c0b86d92ed040f7fa7 (patch) | |
tree | 21d51403e56b21af1dc5052e98232ecb926c425d /org.eclipse.jgit.pgm | |
parent | 86be1b4038581ed6cc94ff1f7a7c3652b0e0b767 (diff) | |
parent | a65e7c75016b72300a02119a6d6d089bafb5b4f7 (diff) | |
download | jgit-3cea3676c75127dd720ea4c0b86d92ed040f7fa7.tar.gz jgit-3cea3676c75127dd720ea4c0b86d92ed040f7fa7.zip |
Merge branch 'stable-5.4'
* stable-5.4: (82 commits)
Export all packages of o.e.j.ant and o.e.j.archive bundles
Do not require test bundles to export all packages
Fix API problem filters
Increase severity of AmbiguousMethodReference to ERROR
[error prone] suppress AmbiguousMethodReference in AnyLongObjectId
[error prone] fix ReferenceEquality warning in CommitBuilder
[error prone] suppress NonAtomicVolatileUpdate warning in SimpleLruCache
[error prone] fix ReferenceEquality warning in CommitGraphPane#authorFor
[error prone] fix ReferenceEquality warning in RevWalk#isMergedInto
[error prone] fix ReferenceEquality warning in RefUpdate#updateImpl
[error prone] fix ReferenceEquality warning in static equals methods
[error prone] suppress AmbiguousMethodReference in AnyObjectId
[error prone] fix "FutureReturnValueIgnored" error in FS
Fix formatting and add missing braces in Repository#stripWorkDir
Repository: fix reference comparison of Files
MergeAlgorithm: Suppress Error Prone warning about reference equality
Fix NarrowingCompoundAssignment warnings from Error Prone
FS_POSIX: handle Files.getFileStore() failures
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
GlobalBundleCache: Fix ClassNewInstance warning from Error Prone
IncorrectObjectTypeException: Fix typos in constructors' Javadoc
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
Error Prone: Increase severity of NonOverridingEquals to ERROR
Error Prone: Increase severity of ImmutableEnumChecker to ERROR
GitDateParser#ParseableSimpleDateFormat: Make formatStr private final
BatchRefUpdateTest: Suppress ImmutableEnumChecker warning
PacketLineIn: Suppress comparison warnings for END and DELIM
FileSnapshot#toString: Suppress ReferenceEquality warnings
Blame: Suppress ReferenceEquality warning for RevCommit instances
Fix API problem filters
pgm: add missing optional dependency to org.tukaani:xz
NetscapeCookieFile: Make hash static and group overloaded write
NetscapeCookieFile: Javadoc fixes
Config: Handle reference-equality warning (and empty javadoc)
Error Prone: Increase severity of ShortCircuitBoolean to ERROR
ObjectWalk: Prefer boolean operators over logical operators in comparisons
BasePackFetchConnection: Prefer boolean operators over logical operators in comparisons
PackWriter: Prefer boolean operators over logical operators in comparisons
Change-Id: I825fd55bcb5345fb7afe066bf54ca50325f40acb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
5 files changed, 35 insertions, 14 deletions
diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index 12ccadd9c3..c6af997cca 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -142,6 +142,12 @@ <artifactId>org.eclipse.jgit.lfs.server</artifactId> <version>${project.version}</version> </dependency> + + <dependency> + <groupId>org.tukaani</groupId> + <artifactId>xz</artifactId> + <optional>true</optional> + </dependency> </dependencies> <build> diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java index 8794ca6cbe..e38cb468d9 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java @@ -218,7 +218,8 @@ class Blame extends TextBuiltin { dateWidth = Math.max(dateWidth, date(line).length()); pathWidth = Math.max(pathWidth, path(line).length()); } - while (line + 1 < end && blame.getSourceCommit(line + 1) == c) { + while (line + 1 < end + && sameCommit(blame.getSourceCommit(line + 1), c)) { line++; } maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); @@ -257,13 +258,22 @@ class Blame extends TextBuiltin { blame.getResultContents().writeLine(outs, line); outs.flush(); outw.print('\n'); - } while (++line < end && blame.getSourceCommit(line) == c); + } while (++line < end + && sameCommit(blame.getSourceCommit(line), c)); } } catch (NoWorkTreeException | IOException e) { throw die(e.getMessage(), e); } } + @SuppressWarnings("ReferenceEquality") + private static boolean sameCommit(RevCommit a, RevCommit b) { + // Reference comparison is intentional; BlameGenerator uses a single + // RevWalk which caches the RevCommit objects, and if a given commit + // is cached the RevWalk returns the same instance. + return a == b; + } + private int uniqueAbbrevLen(ObjectReader reader, RevCommit commit) throws IOException { return reader.abbreviate(commit, abbrev).length(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index 05f237837f..d81a3aedc7 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -45,8 +45,8 @@ package org.eclipse.jgit.pgm; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SECTION_I18N; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_LOG_OUTPUT_ENCODING; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SECTION_I18N; import static org.eclipse.jgit.lib.Constants.R_HEADS; import static org.eclipse.jgit.lib.Constants.R_REMOTES; import static org.eclipse.jgit.lib.Constants.R_TAGS; 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(' '); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java index b38de14af9..15b6ff9a9a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java @@ -189,7 +189,7 @@ class VerifyReftable extends TextBuiltin { return; } - if (!AnyObjectId.equals(exp.getObjectId(), act.getObjectId())) { + if (!AnyObjectId.isEqual(exp.getObjectId(), act.getObjectId())) { throw die(String.format("expected %s to be %s, found %s", exp.getName(), id(exp.getObjectId()), @@ -197,7 +197,8 @@ class VerifyReftable extends TextBuiltin { } if (exp.getPeeledObjectId() != null - && !AnyObjectId.equals(exp.getPeeledObjectId(), act.getPeeledObjectId())) { + && !AnyObjectId.isEqual(exp.getPeeledObjectId(), + act.getPeeledObjectId())) { throw die(String.format("expected %s to be %s, found %s", exp.getName(), id(exp.getPeeledObjectId()), |