aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs/src/org/eclipse
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated static AnyLongObjectId#equals methodMatthias Sohn2024-09-031-19/+1
| | | | Change-Id: Ie67b9a4a5e1972ec3aebf50e058a9aabf5a20099
* [errorprone] Fix error pattern JdkObsoleteMatthias Sohn2024-04-291-3/+3
| | | | | | See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
* [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-252-0/+4
| | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* [errorprone] Suppress JavaLangClash to avoid breaking changeMatthias Sohn2023-09-251-0/+2
| | | | | | | | | Renaming this class is a breaking change. Add a todo to rename it in next major release. See https://errorprone.info/bugpattern/JavaLangClash Change-Id: I3528fd654e30d98f4ea43e71107d83324942141c
* [errorprone] Fix EqualsGetClassMatthias Sohn2023-09-251-1/+1
| | | | | | See https://errorprone.info/bugpattern/EqualsGetClass Change-Id: Ida19a7e60656f87518e5ae2ef5eae511edb5b837
* [errorprone] Suppress MissingSummary for translation bundlesMatthias Sohn2023-09-251-0/+1
| | | | Change-Id: I4da51c7e089366b016a0cc64f768a151c24bc956
* [errorprone] Remove unnecessary parenthesesMatthias Sohn2023-09-221-2/+2
| | | | | | see https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: Id08cf0e05b3d35f139fc34e0aa83882555a8a81a
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-1611-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* Lazy loading of .lfsconfig.Matthias Fromme2022-04-301-21/+41
| | | | | | | | Load the '.lfsconfig ' on access instead of trying to load it unconditionally each time an LFS filter is applied. Bug 578020 Change-Id: I986d4e61a736fc83cf00e62a08d8413c6bb53f78
* [push, lfs] Tell the pre-push hook whether the push is a dry runThomas Wolf2022-03-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This is a feature that does not exist in C git: an external pre-push hook doesn't know whether the push is run as a dry run. But for internal hooks written in Java it is entirely possible to give a hook this information. In JGit with its internal LFS implementation, this enables us to not perform LFS uploads in a dry run. This is kind of important because EGit frequently does a dry-run before doing the actual push to give the user a way to review what would be pushed before it actually happens. Doing an LFS upload of potentially huge files during a dry-run is wasteful, makes the dry run not actually a dry run, and leads to uploading the same file twice if followed by a real push. Use the information in the LfsPrePushHook to only do the initial call to the LFS server, but then skipping the actual upload if the push is a dry run. That way, a failure to contact the LFS server leads to an error in the dry run, as it should. Bug: 546567 Change-Id: I155430f27c4979d91096ba72fd95c3775dd3f28b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* LFS: clean up messagesThomas Wolf2022-03-211-1/+0
| | | | | | Remove an unused message, and remove unnecessary quotes. Change-Id: I9da3eeb3db33324fa07bebd434bca3c0a4da27ab Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix typos of some keys in LfsTextMatthias Sohn2022-03-033-4/+4
| | | | Change-Id: I86dee0b68e627e26cbd29976162bc7b953ebf276
* Sort LfsText entries alphabeticallyMatthias Sohn2022-03-031-8/+8
| | | | Change-Id: I3021cb246b51d861d51258808c75d5c6843ec82d
* Support for "lfs.url" from ".lfsconfig"Matthias Fromme2022-03-034-8/+216
| | | | | | | | | | | - New class LfsConfig to enrich repository configuration by settings from ".lfsconfig" file respecting configuration file precedence. - Adapted LfsConnectionFactory to use LfsConfig instead of directly using configuration from repository to calculate url of the lfs repository Bug: 578020 Change-Id: I156f4ec137c2e428136a2ca9b8a4011ecee2d915
* Support LFS Server URL without .git suffixNail Samatov2022-02-081-6/+23
| | | | | | | | | | | | | | | | | | | | According to Git LFS documentation, URLs with and without .git suffix should be supported. By default, Git LFS will append .git/info/lfs to the end of a Git remote URL. To build the LFS server URL it will use: Git Remote: https://git-server.com/foo/bar LFS Server: https://git-server.com/foo/bar.git/info/lfs Git Remote: https://git-server.com/foo/bar.git LFS Server: https://git-server.com/foo/bar.git/info/lfs Fix the LfsConnectionFactory accordingly. Move a utility method to add the ".git" suffix if not present yet from FileResolver to StringUtils and use it. Bug: 578621 Change-Id: I8d3645872d5f03bb8e82c9c73647adb3e81ce484 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* LFS: Fix error occurring during delete branchNail Samatov2022-01-271-0/+3
| | | | | | | | | | | | | | | | | Fix TransportException occurring when deleting a branch and push that change to remote repository if BuiltinLFS is used to work with repository. When finding LFS pointers in RemoteRepUpdate, LfsPrePushHook fails to open ObjectReader with new object id equal to ObjectId.zeroId(). If update is a deleting update (new object id is zero id), we can assume that this update doesn't contain LFS Pointer and we can skip step with extracting LFS pointer for that RemoteRefUpdate. Bug: 578313 Change-Id: Ic4367978338b8234d39d9af0d9674490f79fc22d Signed-off-by: Nail Samatov <sanail@yandex.ru>
* LFS: handle invalid pointers betterThomas Wolf2021-03-014-49/+145
| | | | | | | | | | | | Make sure that SmudgeFilter calls LfsPointer.parseLfsPointer() with a stream that supports mark/reset, and make sure that parseLfsPointer() resets the stream properly if it decides that the stream content is not a LFS pointer. Add a test. Bug: 570758 Change-Id: I2593d67cff31b2dfdfaaa48e437331f0ed877915 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* LFS: make pointer parsing more robustThomas Wolf2021-01-311-12/+60
| | | | | | | | | | | | | | | | | Parsing an LFS pointer must check the input more to not run into exceptions. LfsPoint.parseLfsPointer() is used in various places to determine whether a blob is a LFS pointer; it is not only called with valid LFS pointers. Tighten the validations and return null if they fail. All callers already do check for a null return value. Also, LfsPointer implemented Comparable but did not override equals(). This is rather unusual and actually warned against in the javadoc of Comparable. Implement equals() and hashCode(). Add more tests. Bug: 570744 Change-Id: I90ca264d0a250275cf1907e9dcfcee5eab80df0f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [spotbugs] parse time using thread-safe DateTimeFormatterMatthias Sohn2020-12-171-5/+9
| | | | | | | LfsConnectionFactory used a static SimpleDateFormat which isn't thread-safe. Use DateTimeFormatter instead to fix this. Change-Id: Id580251c999e1e412c269f37b29860d310124c89 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loopDavid Pursehouse2020-06-291-1/+1
| | | | | | | | | | | | | When iterating over the remote URLs to find one that matches "origin", it always exits after the first iteration whether it has found the remote or not. The break should be inside the conditional block so that it exits when "origin" is found, otherwise continues to iterate over the remaining remote URLs. Found by Sonar Lint. Change-Id: Ic969e54071d1cf095334007c1c1bab6579044dd2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix BadComparable error flagged by error proneDavid Ostrovsky2020-06-011-1/+1
| | | | | | | | | | | | | | | Running recent error prone version complaining on that code: LfsPointer.java:171: error: [BadComparable] Possible sign flip from narrowing conversion return (int) (getSize() - o.getSize()); ^ (see https://errorprone.info/bugpattern/BadComparable) Did you mean 'return Long.compare(getSize(), o.getSize());'? Bug: 562756 Change-Id: I0522f1025319a9290c448a064fbafdb4b16d1d59 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Fix downloading LFS Object fails behind proxyMatthias Sohn2020-05-121-1/+2
| | | | | | | | When downloading LFS objects also accept response code 203 as successful download. This response may be seen when downloading via a proxy. Bug: 563022 Change-Id: Iee85fdb451b33369d08859872e5bfc2a67dffa6d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-5.6'Matthias Sohn2020-02-222-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.6: Revert "Prepend hostname to subsection used to store file timestamp resolution" SimilarityRenameDetector: Fix inconsistent indentation Use indexOf(char) and lastIndexOf(char) rather than String versions Reorder modifiers to follow Java Language Specification GitmoduleEntry: Remove redundant import of class from same package Remove redundant "static" qualifier from enum declarations Change-Id: Ibb66bef7e8373f81e3e653c9843d986243446d68 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Reorder modifiers to follow Java Language SpecificationDavid Pursehouse2020-02-192-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Java Language Specification recommends listing modifiers in the following order: 1. Annotations 2. public 3. protected 4. private 5. abstract 6. static 7. final 8. transient 9. volatile 10. synchronized 11. native 12. strictfp Not following this convention has no technical impact, but will reduce the code's readability because most developers are used to the standard order. This was detected using SonarLint. Change-Id: I9cddecb4f4234dae1021b677e915be23d349a380 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | ErrorProne: Enable and fix UnusedException checkDavid Pursehouse2020-01-274-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable UnusedException at ERROR level which causes the build to fail in many places with: [UnusedException] This catch block catches an symbol and re-throws another, but swallows the caught symbol rather than setting it as a cause. This can make debugging harder. Fix it by setting the caught exception as cause on the subsequently thrown exception. Note: The grammatically incorrect error message is copy-pasted as-is from the version of ErrorProne currently used in Bazel; it has been fixed by [1] in the latest version. [1] https://github.com/google/error-prone/commit/d57a39c Change-Id: I11ed38243091fc12f64f1b2db404ba3f1d2e98b5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-0432-1216/+160
|/ | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add ability to redirect stderr from git hooksTim Neumann2019-12-092-0/+24
| | | | | | | | | | | | | This will change the behavior in the CLI to resemble that of C-Git more closely by printing the stderr of the hooks to the CLI stderr independently of the exit code of the hook. This is also useful for the corresponding EGIT-Change, which will add the ability to show the hook output in eclipse. With this also the stderr can be shown even if the exit code is 0. Bug: 553471 Change-Id: Ie7bc503fe39e270e9b93dd1108b5879f02a12b4c Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
* Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-174-34/+28
| | | | | | | | | | | | | | | Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-5.4'Matthias Sohn2019-08-201-21/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.4: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Upgrade tycho-extras to 1.4.0 Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I709de5edb626536529a99220aae7751b127c9bff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-08-201-21/+20
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I43c2ab8b44c3e87d48e4072907ad169c81e3ffe0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-08-191-21/+20
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I48c585f3c9287be7d6ddb6b01a1955444e13fa31 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Cache user global and system-wide git configurationsMatthias Sohn2019-08-181-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far the git configuration and the system wide git configuration were always reloaded when jgit accessed these global configuration files to access global configuration options which are not in the context of a single git repository. Cache these configurations in SystemReader and only reload them if their file metadata observed using FileSnapshot indicates a modification. Change-Id: I092fe11a5d95f1c5799273cacfc7a415d0b7786c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Merge branch 'stable-5.4'Matthias Sohn2019-08-091-1/+23
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * | | [error prone] suppress AmbiguousMethodReference in AnyLongObjectIdDavid Pursehouse2019-08-091-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the implementation of the static equals() method to a new method and suppress the error. Deprecate the old method to signal that we intend to remove it in the next major release. See https://errorprone.info/bugpattern/AmbiguousMethodReference Change-Id: I712697a411ab44c6e05ae4604eb2dcb9c0f8abd3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | | [error prone] fix ReferenceEquality warning in static equals methodsMatthias Sohn2019-08-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a helper method suppressing the ReferenceEquality error prone warning and use it to fix this warning in static equals methods where this comparison is used to implement fast path of static equals implementation. See https://errorprone.info/bugpattern/ReferenceEquality Change-Id: I33538a3406007d24efec3a504e031ca1069572ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Error Prone: Increase severity of NonOverridingEquals to ERRORDavid Pursehouse2019-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error Prone reports the warning on several classes: [NonOverridingEquals] equals method doesn't override Object.equals; if this is a type-specific helper for a method that does override Object.equals, either inline it into the callers or rename it to avoid ambiguity. See https://errorprone.info/bugpattern/NonOverridingEquals Most of these are in the public API, so we can't rename or inline them without breaking the API. FileSnapshot is not part of the public API, but clients may be using it anyway, so we also shouldn't change that. Suppress all the warnings instead. Having the check at severity ERROR will at least make sure we don't introduce any new occurrences. Change-Id: I92345c11256f06b4fa03ccc13337f72af5a43591 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Constants for objects and info/{http-,}alternatesDavid Turner2019-08-021-1/+3
|/ / / | | | | | | | | | | | | | | | | | | These are useful to avoid typos, and also for tab completion. Change-Id: I0f2d267e46b36bc40297c9657c447f3fd8b9f831 Signed-off-by: David Turner <dturner@twosigma.com>
* | | Abbreviated{Long}ObjectId: Make operator precedence explicitDavid Pursehouse2019-06-111-1/+1
| | | | | | | | | | | | | | | Change-Id: Iafd616d3fdc81ac3072f776061548be195270d85 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Convert to lambda or member referenceCarsten Hammer2019-05-162-15/+2
|/ / | | | | | | | | | | | | | | | | | | | | Convert anonymous inner classes to lambda expressions or member references Bug: 545856 CQ: 19537 Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Format @NonNull on return value as method annotationJonathan Nieder2018-10-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, instead of using public @NonNull String getMyFavoriteString() { ... } use @NonNull public String getMyFavoriteString() { ... } This makes the style more consistent (the existing JGit code base tends to lean toward the second style) and makes the source code better reflect how the annotation is parsed, as a METHOD annotation. Longer term, we should switch to a TYPE_USE annotation and switch to the first style. Noticed using a style checker that follows https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations Change-Id: I9b9fa08035d805ca660520f812a84d2f47eff507 Reported-by: Ivan Frade <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
* | Format @Nullable on return value as method annotationJonathan Nieder2018-10-092-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, instead of using public @Nullable String getMyFavoriteString() { ... } use @Nullable public String getMyFavoriteString() { ... } This makes the style more consistent (the existing JGit code base tends to lean toward the second style) and makes the source code better reflect how the annotation is parsed, as a METHOD annotation. Longer term, we should switch to a TYPE_USE annotation and switch to the first style. Noticed using a style checker that follows https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations Change-Id: I07f4e67cc149fb8007f696a4663e10d4bfc57e3a Reported-by: Ivan Frade <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
* | [spotBugs] Fix potential NPE in SmudgeFilter#downloadLfsResourceMatthias Sohn2018-09-131-1/+4
|/ | | | Change-Id: Ibaf8481a5b1a96ebe1debfd98e1e2201d1005fc0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8David Pursehouse2018-09-043-10/+10
| | | | | Change-Id: I3b748620f067582afef20f144feebe40d0332be2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Specify charset when constructing InputStreamReaderDavid Pursehouse2018-09-022-2/+3
| | | | | | | | | | | | ErrorProne warns [1] about implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: I0fd489d352170339c3867355cd24324dfdbd4b59 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* refactor: simplify collection.toArray()Michael Keppler2018-08-231-1/+1
| | | | | | | | | | | On recent VMs, collection.toArray(new T[0]) is faster than collection.toArray(new T[collection.size()]). Since it is also more readable, it should now be the preferred way of collection to array conversion. https://shipilev.net/blog/2016/arrays-wisdom-ancients/ Change-Id: I80388532fb4b2b0663ee1fe8baa94f5df55c8442 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
* Propagate failure of ssh command to caller of SshSupportMatthias Sohn2018-06-133-23/+38
| | | | | | | | | | | | When SshSupport.runSshCommand fails since the executed external ssh command failed throw a CommandFailedException. If discovery of LFS server fails due to failure of the git-lfs-authenticate command chain the CommandFailureException to the LfsConfigInvalidException in order to allow root cause analysis in the application using that. Change-Id: I2f9ea2be11274549f6d845937164c248b3d840b2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix issues with LFS on GitHub (SSH)Markus Duft2018-06-122-5/+20
| | | | | | | | | | | | | * URIish seems to have a tiny feature (bug?). The path of the URI starts with a '/' only if the URI has a port set (it seems). * GitHub does not return SSH authorization on a single line as Gerrit does - need to account for that. * Increase the SSH git-lfs-authenticate timeout, as GitHub sometimes responds slower than expected. * Guard against NPE in case the download action does not contain any additional headers. Change-Id: Icd1ead3d015479fd4b8bbd42ed42129b0abfb95c Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
* LFS: Better SSH authentication token timeout handlingMarkus Duft2018-06-091-3/+4
| | | | | | | * Larger eager timeout to compensate for high-latency lines * Respect eager timeout in case the server uses "expiresIn" Change-Id: Id87da1eea874e70b69eaccf35c84af4c3bb50770 Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
* Remove further unnecessary 'final' keywordsHan-Wen Nienhuys2018-05-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-154-42/+42
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>