Commit Graph

573 Commits

Author SHA1 Message Date
Matthias Sohn 30b6887d44 JGit v5.11.0.202103091610-r
Change-Id: I8e6855eaf7228459f492036feb4e34ca085698a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-09 22:10:22 +01:00
Nasser Grainawi 2a6b2eddcf PackFile: Add id + ext based constructors
Add new constructors to PackFile to improve a common use case where
callers know the directory, id, and extension, but previously needed to
construct a valid file name (with prefix, '.', etc) to create a
PackFile. Most callers can use the variant that has id as an ObjectId,
but provide an id as String variant too.

Change-Id: I39e4466abe8c9509f5916d5bfe675066570b8585
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
2021-03-07 00:02:56 +01:00
Nasser Grainawi 971dafd302 Create a PackFile class for Pack filenames
The PackFile class is intended to be a central place to do all
common pack filename manipulation and parsing to help reduce repeated
code and bugs. Use the PackFile class in the Pack class and in many
tests to ensure it works well in a variety of situations. Later changes
will expand use of PackFiles to even more areas.

Change-Id: I921b30f865759162bae46ddd2c6d669de06add4a
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-04 22:19:36 +01:00
Matthias Sohn f659797199 Merge branch 'master' into next
* master: (143 commits)
  Prepare 5.11.0-SNAPSHOT builds
  JGit v5.11.0.202102240950-m3
  [releng] japicmp: update last release version
  IgnoreNode: include path to file for invalid .gitignore patterns
  FastIgnoreRule: include bad pattern in log message
  init: add config option to set default for the initial branch name
  init: allow specifying the initial branch name for the new repository
  Fail clone if initial branch doesn't exist in remote repository
  GPG: fix reading unprotected old-format secret keys
  Update Orbit to S20210216215844
  Add missing bazel dependency for o.e.j.gpg.bc.test
  GPG: handle extended private key format
  dfs: handle short copies
  [GPG] Provide a factory for the BouncyCastleGpgSigner
  Fix boxing warnings
  GPG: compute the keygrip to find a secret key
  GPG signature verification via BouncyCastle
  Post commit hook failure should not cause commit failure
  Allow to define additional Hook classes outside JGit
  GitHook: use default charset for output and error streams
  ...

Change-Id: I689f4070e79f4a0ac1c02b35698ccaab68ad2f34
2021-02-28 00:58:04 +01:00
Nasser Grainawi efb154fc24 Rename PackFile to Pack
Pack better represents the purpose of the object and paves the way to
add a PackFile object that extends File.

Change-Id: I39b4f697902d395e9b6df5e8ce53078ce72fcea3
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
2021-02-10 22:46:15 -07:00
Matthias Sohn 9299df41cb Fix SeparateClassloaderTestRunner on Java 9 or higher
Since Java 9 the SystemClassLoader is no longer a URLClassLoader.

Change-Id: I3aa834f1075e611c86fc4684fda6a50c684b3729
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-02-05 19:45:49 -05:00
Matthias Sohn 1363b1acfe Prepare 5.10.1-SNAPSHOT builds
Change-Id: If1e44edfa0a80a29c00ed5112291d1338baf56f1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-08 17:35:15 +01:00
Matthias Sohn 4262a68f55 JGit v5.10.0.202012080955-r
Change-Id: I7ca88bcc54992625a6fafd84172adee58d487dc3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-08 15:56:08 +01:00
Matthias Sohn ad7806f4ef Prepare 5.10.0-SNAPSHOT builds
Change-Id: I9cc9fa32a737b4916cdb5b52bac8f724ebee09bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 21:11:20 +01:00
Matthias Sohn 13b866a6f8 JGit v5.10.0.202012021225-rc1
Change-Id: Ic774356e09bb9d24e5d99334bd4ea173bd4071ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 18:25:20 +01:00
Matthias Sohn 9034c7d423 Prepare 5.11.0-SNAPSHOT builds
Change-Id: I91e5532526775191fbd34f81e2ef777cba605e3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 15:57:16 +01:00
Matthias Sohn 0a63e045c9 Prepare 5.3.10-SNAPSHOT builds
Change-Id: I6f131ad04574bd0d569ae6a59c29ea987be0efb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 13:09:57 +01:00
Matthias Sohn aa5d1e425c JGit v5.3.9.202012012026-r
Change-Id: I75e03ef8630d7a369e97be0f797253b968575354
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 02:27:44 +01:00
Matthias Sohn 286ad23cb5 Merge branch 'master' into next
* master:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features
  Add support for reading symrefs from pack capabilities
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Prepare 5.10.0-SNAPSHOT builds
  JGit v5.10.0.202011251205-m3
  PacketLineIn: ensure that END != DELIM
  Update Orbit to S20201118210000 and add target for 4.18
  PacketLineIn: ensure that END != DELIM
  PacketLineIn: ensure that END != DELIM
  Allow to resolve a conflict by checking out a file
  Update Orbit to I20201111205634
  Document that setLastModified sets time of symlink target
  Fix bug in PerformanceLogContext
  Fix IOException occurring during gc
  Prepare 5.10.0-SNAPSHOT builds
  JGit v5.10.0.202011041322-m2
  Revert "Client-side protocol V2 support for fetching"
  Close Repository to fix tests failing on Windows
  Client-side protocol V2 support for fetching
  Update slf4j to 1.7.30
  Update Orbit to S20201027182932 (2020-12 M2)
  Fix formatting of config option values
  Document options in core section supported by JGit
  Ensure .gitmodules is loaded when accessing submodule name
  Export new package org.eclipse.jgit.logging and import it where used
  Ensure GC.deleteOrphans() can delete read-only orphaned files on Windows
  Add new performance logging
  Implement git describe --all
  Compute time differences with Duration
  Override config http.userAgent from environment GIT_HTTP_USER_AGENT
  Upgrade spotbugs-maven-plugin to 4.1.3
  Fix OperatorPrecedence warning flagged by error prone
  UploadPackTest#testUploadRedundantBytes: ensure test repo is closed
  ObjectDirectory#selectObjectRepresentation: fix formatting
  Upgrade ecj to 3.23.0
  Support "http.userAgent" and "http.extraHeader" from the git config
  sshd: better error report when user cancels authentication
  API filters for PackStatistics.Accumulator
  Add TypedConfigGetter.getPath()
  Make Javadoc consistent for PackStatistics fields
  Measure time taken for reachability checks
  Measure time taken for negotiation in protocol V2
  IndexDiffFilter: handle path prefixes correctly
  sshd: support the ProxyJump ssh config
  Upgrade jacoco-maven-plugin to 0.8.6
  ReceivePackStats: Add size and count of unnecessary pushed objects
  Upgrade maven-project-info-reports-plugin to 3.1.1
  Prepare 5.9.1-SNAPSHOT builds
  JGit v5.9.0.202009080501-r
  [releng] Enable japicmp for the fragments added in 5.8.0
  GitlinkMergeTest: fix boxing warnings
  Remove unused API problem filters
  Add missing since tag on BundleWriter#addObjectsAsIs
  SshdSession: close channel gracefully
  GPG: include signer's user ID in the signature
  jgit: Add DfsBundleWriter
  Bump Bazel version to 3.5.0
  Upgrade maven-resources-plugin to 3.2.0
  Upgrade plexus-compiler version to 2.8.8
  [bazel] Add missing dependency to slf4j-api
  [errorprone] DirCacheEntry: make clear operator precedence
  [errorprone] PackWriter#parallelDeltaSearch: avoid suppressed exception
  [errorprone] Declare DirCache#version final
  Add jgit-4.17-staging target platform for 2020-09
  Update target platform to R20200831200620
  Prepare 5.10.0-SNAPSHOT builds
  Prepare 5.9.0-SNAPSHOT builds
  ResolveMerger: do not content-merge gitlinks on del/mod conflicts
  ResolveMerger: Adding test cases for GITLINK deletion
  ResolveMerger: choose OURS on gitlink when ignoreConflicts
  ResolveMerger: improving content merge readability
  ResolveMerger: extracting createGitLinksMergeResult method
  ResolveMerger: Adding test cases for GITLINK merge
  JGit v5.9.0.202008260805-m3
  Fix possible NegativeArraySizeException in PackIndexV1
  FS: use binary search to determine filesystem timestamp resolution
  Do not prematurely create directory of jgit's XDG config file
  FS: write to JGit config in a background thread
  FS: don't cache fallback if running in background
  Keep line endings for text files committed with CR/LF on text=auto
  Delay WindowCache statistics JMX MBean registration
  [releng] Update plexus-compiler to 2.8.7
  DirCache: support index V4
  Update javadoc for RemoteSession and SshSessionFactory
  Fix JSchProcess.waitFor() with time-out
  sshd: work around a race condition in Apache MINA sshd 2.4.0/2.5.x
  sshd: store per-session data on the sshd session object
  FilterSpec: Use BigInteger.ZERO instead of valueOf(0)
  Do not send empty blob in response to blob:none filter
  Add support for tree filters when fetching
  sshd: use PropertyResolver in test
  FS_POSIX: avoid prompt to install the XCode tools on OS X
  Remove dependency on JSch from SSH test framework
  Use LinkedBlockingQueue for executor determining filesystem attributes
  Update API warning filters
  Remove unused imports
  Bazel: Add workspace status command to stamp final artifact
  DiffFormatter: correctly deal with tracked files in ignored folders
  Prepare 5.8.2-SNAPSHOT builds
  JGit v5.8.1.202007141445-r
  Update Jetty to 9.4.30.v20200611
  Fix writing GPG signatures with trailing newline
  Rename a test method
  Add a test for upstream bug SSHD-1028
  Improve error message when receive.maxCommandBytes is exceeded
  LfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loop
  DiffFormatterTest: Add a test to confirm the default rename detection settings
  Upgrade maven-site-plugin to 3.9.1
  Upgrade build-helper-maven-plugin to 3.2.0
  Upgrade spotbugs to 4.0.4
  MergedReftable: Include the last reftable in determining minUpdateIndex
  Add new osgi fragments to maven-central deploy scripts
  PackBitmapIndex: Not buffer inflated bitmap during bitmap creation.
  Do not require org.assertj.core.annotations
  Upgrade ecj to 3.22.0
  Remove workaround for signing jars using Tycho plugins
  Use https for URL of jgit website
  Fix CI information in pom.xml
  Use gitiles as scm url in pom.xml for browsing source code
  Update API baseline to 5.8.0.202006091008-r
  Remove trailing whitespace

Change-Id: Ie6bc6954741a47cfbd32c0886bdbd7b594f08b31
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-28 21:51:50 +01:00
Matthias Sohn fdcdfc37a3 Prepare 5.3.9-SNAPSHOT builds
Change-Id: I69f181453c79cef2b4f43fac38d9836917cdc973
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-26 16:30:32 +01:00
Matthias Sohn 0e9cf495d9 JGit v5.3.8.202011260953-r
Change-Id: I7b128942ef224335f415f867c2d9d5da7498ed8b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-26 15:52:53 +01:00
Matthias Sohn 63f16c53c8 Prepare 5.10.0-SNAPSHOT builds
Change-Id: Iabc845edf565ac706344f68f854384faa63b6f43
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-25 22:30:34 +01:00
Matthias Sohn 2486be2706 JGit v5.10.0.202011251205-m3
Change-Id: Id58d8eb49f550e62b04053a71366f7eabd9f9a53
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-25 18:05:35 +01:00
Matthias Sohn 2993b2fead Prepare 5.10.0-SNAPSHOT builds
Change-Id: Ie13f90948669c8cdebd14e74a91df9daf0387ccf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-04 23:48:37 +01:00
Matthias Sohn 6c17f3d23b JGit v5.10.0.202011041322-m2
Change-Id: Ia2709321f61f61208350eaa8aa48e56b88455146
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-04 19:38:49 +01:00
Nail Samatov 5dcc46591a Close Repository to fix tests failing on Windows
Fix tests failing on Windows because Repository
instance is created but not closed on tear down.

Change-Id: I72488ba5efeec95110926b1fbd56b7d96fca0d37
Signed-off-by: Nail Samatov <sanail@yandex.ru>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-01 21:03:43 +01:00
Matthias Sohn ed9992896a Prepare 5.9.1-SNAPSHOT builds
Change-Id: I9006e7961111982943ffef496d15bd525959b3e4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-08 17:45:20 +02:00
Matthias Sohn dd169769bf JGit v5.9.0.202009080501-r
Change-Id: Ic98ae61b3f327ef72256fd9b2e28510e3a481de7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-08 13:01:43 +02:00
Matthias Sohn daddfe051b Merge branch 'master' into stable-5.9
* master:
  SshdSession: close channel gracefully
  jgit: Add DfsBundleWriter
  Prepare 5.10.0-SNAPSHOT builds
  ResolveMerger: do not content-merge gitlinks on del/mod conflicts
  ResolveMerger: Adding test cases for GITLINK deletion
  ResolveMerger: choose OURS on gitlink when ignoreConflicts
  ResolveMerger: improving content merge readability
  ResolveMerger: extracting createGitLinksMergeResult method
  ResolveMerger: Adding test cases for GITLINK merge

Back out the version change to 5.10.0-SNAPSHOT which was done on master
already.

Change-Id: I1a6b1f0b8f5773be47823d74f593d13b16a601d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-05 22:51:34 +02:00
Terry Parker 957419610a Merge changes from topic "fix_ui"
* changes:
  ResolveMerger: do not content-merge gitlinks on del/mod conflicts
  ResolveMerger: Adding test cases for GITLINK deletion
  ResolveMerger: choose OURS on gitlink when ignoreConflicts
  ResolveMerger: improving content merge readability
  ResolveMerger: extracting createGitLinksMergeResult method
  ResolveMerger: Adding test cases for GITLINK merge
2020-09-03 18:35:24 -04:00
Matthias Sohn 6ae1a30004 Prepare 5.10.0-SNAPSHOT builds
Change-Id: I9a2b39e9e85f27179ceb3b1709d75c466089a3bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-08-27 16:14:36 +02:00
Matthias Sohn a3d7240352 Prepare 5.9.0-SNAPSHOT builds
Change-Id: Ia3e8382ec503150979d8acb6161031ccfb7fd921
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-08-27 10:22:51 +02:00
Demetr Starshov e60ea7324f ResolveMerger: Adding test cases for GITLINK merge
Add test cases which cover content-merge resolve logic.

Git clients try to agressively merge blobs by content, but GITLINK types
of entries can't be merged with each other or with blobs. This change
ensures all possible permutations which can trigger blob and GITLINK
content merge are covered.

Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: I7e83a28a14d4d2f9e0ba2b1cffbf3224fb7f3fef
2020-08-26 18:39:38 -07:00
Matthias Sohn bf6b2b9314 JGit v5.9.0.202008260805-m3
Change-Id: Ic4de8340f3ab038e38b239b725b8bd6d6dbee413
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-08-26 14:05:07 +02:00
Matthias Sohn b5ba237559 Prepare 5.8.2-SNAPSHOT builds
Change-Id: I33327417cd5f5b55e860c5d9c6ee06cac7d10b44
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-07-14 20:53:51 +02:00
Matthias Sohn 246954e0d6 JGit v5.8.1.202007141445-r
Change-Id: Ib63831292eded15af18ed30a9653831dadfd0d4a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-07-14 20:43:21 +02:00
Matthias Sohn 6abe695aa5 Prepare 5.8.1-SNAPSHOT builds
Change-Id: Ic654fb45abe4e94f4eee532af0f4278d372d37f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 16:45:56 +02:00
Matthias Sohn 8e79d5a290 JGit v5.8.0.202006091008-r
Change-Id: I2020e9821c359b90b7c830031945e2fc659ea607
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 16:07:50 +02:00
Matthias Sohn 855842af19 Prepare 5.9.0-SNAPSHOT builds
Change-Id: Ia998e2772df1285a4c674b07201f15d53156eb78
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 12:51:12 +02:00
Matthias Sohn d1ea716bd0 Prepare 5.8.0-SNAPSHOT builds
Change-Id: Ic7d763b3b02b4d2a7a4141d2d9d715855dd69918
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-05-07 00:14:46 +02:00
Matthias Sohn 75fcccaea3 JGit v5.8.0.202005061305-m2
Change-Id: I9d9e5a9e000a74513896744cc3646430cb872893
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-05-06 19:06:11 +02:00
Matthias Sohn 0d78edad53 Prepare 5.7.1-SNAPSHOT builds
Change-Id: I29cd1b9872603810f9c4d42424ac326fedf5569f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-11 13:35:23 +01:00
Matthias Sohn 0713f6e962 JGit v5.7.0.202003110725-r
Change-Id: Ia4a9122eeb4eea0f379f6611984cfe1143a32f8d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-11 13:24:54 +01:00
Matthias Sohn cfc4f01149 Merge branch 'master' into next
* master:
  Prepare 5.7.1-SNAPSHOT builds
  Prepare 5.8.0-SNAPSHOT builds
  JGit v5.7.0.202003090808-r
  Silence API errors introduced by 093fbbd1
  Bump Bazel version to 2.2.0
  Add validation to hex decoder
  Expose FileStoreAttributes.setBackground()
  Update reftable storage repo layout
  Add 4.14 and 4.15-staging target platforms
  Update Orbit to R20200224183213 for final 2020-03
  Update Orbit to S20200224183213 for 2020-03 RC1
  Cygwin expects forward slashes for commands to be run via sh.exe
  [releng] Update year in copyright notices for features
  Using for-each loop in jdt
  Make Logger instances final
  Move array designators from the variable to the type
  ObjectWalk: Add null check before skip tree.
  Revert "RevWalk: stop mixing lines of history in topo sort"
  Do not fail if known hosts file does not contain valid host key
  Prepare 5.7.0-SNAPSHOT builds
  JGit v5.7.0.202002241735-m3
  Update Orbit to S20200219023850 for 2012-03 M3

Change-Id: I6a219888699ebf6d768f2b8fe33a6d2ca9d4c392
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-10 00:52:52 +01:00
Matthias Sohn d408e41e4e Prepare 5.7.1-SNAPSHOT builds
Change-Id: I23748c20b69a1cfb47c5cd0d7858182d376b3ce1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-09 23:37:43 +01:00
Matthias Sohn 8fab712f75 Prepare 5.8.0-SNAPSHOT builds
Change-Id: I056b45806a82eae80177932e42e3dc806015351a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-09 22:47:10 +01:00
Matthias Sohn f5793bea53 JGit v5.7.0.202003090808-r
Change-Id: Ia23bffa3952687f6107d496a8932d54b11c12412
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-03-09 14:09:24 +01:00
Matthias Sohn 2161c1e5e4 Merge branch 'stable-5.6'
* stable-5.6:
  Cygwin expects forward slashes for commands to be run via sh.exe
  Make Logger instances final
  Move array designators from the variable to the type

Change-Id: I9a5dc570deb478525bf48ef526d8cba5b19418bf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-28 23:53:32 +01:00
David Pursehouse 14a157dff6 Make Logger instances final
Change-Id: Ibb997952917e47bc31a8cbe3863623bc959a8100
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-02-27 20:32:29 +09:00
Matthias Sohn c885cbd11e Prepare 6.0.0-SNAPSHOT builds
Purpose of the next branch is preparation of breaking changes before
we know when we will release it. Bump the version to the next major
release 6.0.0-SNAPSHOT in order to prevent build results compete with
build results from the version currently used on the master branch
(5.7.0-SNAPSHOT).

Bug: 560424
Change-Id: Iba64a0124f5bfc167098d829a7ef29650948e2d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-23 23:07:14 +01:00
Matthias Sohn 2899483e96 Prepare 5.6.2-SNAPSHOT builds
Change-Id: Ie04d749bf16eea6db5e5c98be54ba093ca249d05
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-14 00:15:39 +01:00
Matthias Sohn 1b44f0e4a6 JGit v5.6.1.202002131546-r
Change-Id: I2807b9a9f7e8b877b72702ebd1f70c4f9f223481
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-13 21:45:37 +01:00
Matthias Sohn 003e4cfc23 Prepare 5.3.8-SNAPSHOT builds
Change-Id: I64ef3b4cf30e87d058001c2c6f1458f4b0c1df00
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-11 11:54:11 +01:00
Matthias Sohn 0c3b425099 JGit v5.3.7.202002110540-r
Change-Id: I3ba41af516b9d3b74ac580b3e170ad0e6e0663d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-02-11 11:37:34 +01:00
David Pursehouse 4cc13297cc ErrorProne: Enable and fix UnusedException check
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>
2020-01-27 14:40:08 +01:00
David Pursehouse c02a57f4fa Update to Orbit I20200120214610 and JUnit to 4.13
Since version 4.13 JUnit has an assertThrows method. Remove the
implementation in MoreAsserts and use the one from JUnit.

CQ: 21439
Change-Id: I086baa94aa3069cebe87c4cbf91ed1534523c6cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-01-22 18:16:14 +01:00
Matthias Sohn 5c5f7c6b14 Update EDL 1.0 license headers to new short SPDX compliant format
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>
2020-01-04 01:10:05 +01:00
Matthias Sohn 4cb80f897f Prepare 5.6.1-SNAPSHOT builds
Change-Id: Iaa72d2ea6764ccd4fb6a124b51d89fe6492c602d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-11 02:04:21 +01:00
Matthias Sohn 9710c6292a JGit v5.6.0.201912101111-r
Change-Id: Icbb3b46f9d04e45da53936860e07e69fde12971c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-10 17:35:05 +01:00
Matthias Sohn f487a9eb2e Prepare 5.7.0-SNAPSHOT builds
Change-Id: I7efa0cd08dee711d6fefc3e6bb478a3cb11fe85c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 01:32:59 +01:00
Matthias Sohn 473527e42c Prepare 5.6.0-SNAPSHOT builds
Change-Id: I5e737ff7f262fdd43fc975a0b3594c8b33919663
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-04 22:13:56 +01:00
Matthias Sohn a7e454bc51 JGit v5.6.0.201912041214-rc1
Change-Id: I5ed21fbc5f83096bf0b79f2aa751db415cbcc7e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-04 18:14:43 +01:00
Matthias Sohn 4ea42bc816 Prepare 5.6.0-SNAPSHOT builds
Change-Id: I1e52d2dfb202b87ecb9d0273deaa2c8d8ce1864e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-27 21:25:38 +01:00
Matthias Sohn 6c9aa82f70 JGit v5.6.0.201911271000-m3
Change-Id: I3810892c2bed947e4dfaa615a7b4d93eeb46abb9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-27 16:01:20 +01:00
Matthias Sohn 826317942f Merge branch 'stable-5.5'
* stable-5.5:
  BaseReceivePack: Fix the format
  Prepend hostname to subsection used to store file timestamp resolution
  Store filesystem timestamp resolution in extra jgit config
  SystemReader: extract updating config and its parents if outdated

Change-Id: Iecfddce8081303af29badcdcd3d72a0da50c964f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-11 11:07:17 -08:00
Matthias Sohn 838b5a84b5 Store filesystem timestamp resolution in extra jgit config
This avoids polluting hand-crafted user level config with
auto-configured options which might disturb in environments where
the user level config is replicated between different machines.

Add a jgit config as parent of the system level config. Persist
measured timestamp resolutions always in this jgit config and read it
via the user global config. This has the effect that auto-configured
timestamp resolution will be used by default and can be overridden in
either the system level or user level config.

Store the jgit config under the XDG_CONFIG_HOME directory following the
XDG base directory specification [1] in order to ensure that we have
write permissions to persist the file. This has the effect that each OS
user will use its jgit config since they typically use different
XDG_CONFIG_HOME directories.

If the environment variable XDG_CONFIG_HOME is defined the jgit config
file is located at $XDG_CONFIG_HOME/jgit/config otherwise the default is
~/.config/jgit/config.

If you want to avoid redundant measurement for different OS users
manually copy the values measured and auto-configured for one OS user to
the system level git config.

[1] https://wiki.archlinux.org/index.php/XDG_Base_Directory

Bug: 551850
Change-Id: I0022bd40ae62f82e5b964c2ea25822eb55d94687
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-09 18:01:19 +01:00
David Pursehouse 98cdca9b5a Enable and fix "Statement unnecessarily nested within else clause" warnings
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>
2019-10-17 10:20:14 +09:00
Matthias Sohn b570b6907c Prepare 5.5.2-SNAPSHOT builds
Change-Id: Ief9940182fd6e3f3e2df88e6485be753c1260e6b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-03 02:06:57 +02:00
Matthias Sohn 2796d86d1e JGit v5.5.1.201910021850-r
Change-Id: I9930b35b095f638119b4601a8311257daf5e5420
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-03 00:49:02 +02:00
Matthias Sohn ca207cd3ae Prepare 5.3.7-SNAPSHOT builds
Change-Id: I3465b6a4d913bfb2864abba58448423e7c262f60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 11:23:28 +02:00
Matthias Sohn 38258f3f72 JGit v5.3.6.201910020505-r
Change-Id: I12d1c6af03f2d7474c99c22cd2aabb77e95fcb32
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 11:03:41 +02:00
Matthias Sohn 7f262b8745 Prepare 5.5.1-SNAPSHOT builds
Change-Id: Iaf929168770dfef54ce2a7bfcbee9b87c450ca8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-11 11:46:58 +02:00
Matthias Sohn de2df8adde JGit v5.5.0.201909110433-r
Change-Id: I5715730ac47d32462f235c2f50581bf1579d46b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-11 10:31:38 +02:00
Matthias Sohn 830e214805 Merge branch 'stable-5.5'
* stable-5.5:
  bazel: fix running http tests
  Set parameter name in parameterized http tests
  Format BUILD files with buildifier
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Idb0848dd33a76328b24908dc86db335cca742a1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 17:36:59 +02:00
Matthias Sohn b31d5360f0 Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Format BUILD files with buildifier
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Idf3abd80ad3b00188f655e638d9908228770911f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 17:35:14 +02:00
Matthias Sohn 80fd4cb075 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iaea77a89fcd821df5dbb24f5e3e39e6d1dfc0bd4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 15:05:19 +02:00
Matthias Sohn 82badd0a87 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: I0d8b7f79177a20dc00c89e2cf0005eb3d3039532
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 11:17:32 +02:00
Matthias Sohn 38198972d4 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iea37a8e39e9d4872dc607c9222dcf191ce4e4757
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-07 12:16:42 +02:00
David Pursehouse 85cea8c583 Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
Change-Id: I24746335db132bf20f400cb3db400737596d4542
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 15:36:11 +09:00
Matthias Sohn fdd63b183c Prepare 5.5.0-SNAPSHOT builds
Change-Id: I96bbefd698c74e450d05d21572d4769c6c5aaea6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 18:00:19 +02:00
Matthias Sohn 685f2f8ec4 JGit v5.5.0.201909041048-rc1
Change-Id: I77a8c73cfd0a27b1242eddf32da513ce0148260e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 16:47:57 +02:00
Matthias Sohn 32116da0cd Prepare 5.4.4-SNAPSHOT builds
Change-Id: I64c03436c285bd8eb5e87abe560417402b60e695
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:48:25 +02:00
Matthias Sohn fb08804e91 JGit v5.4.3.201909031940-r
Change-Id: I48ff1d51122ff73e0561f1fcf52a532221810e5d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:40:09 +02:00
Matthias Sohn 927ae2f55b Prepare 5.3.6-SNAPSHOT builds
Change-Id: I4d57f8ea0ab1f8fbd73fd75861f2f751c4aba0a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:03:41 +02:00
Matthias Sohn 2a3c8a86aa JGit v5.3.5.201909031855-r
Change-Id: I7f5dcebc2e5816c845fa63046c67bc2301926e2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 00:54:34 +02:00
Matthias Sohn c8e42ca3ba Prepare 5.1.12-SNAPSHOT builds
Change-Id: I353ac3f23024063722abc7340bc9a6df3c615741
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 22:56:39 +02:00
Matthias Sohn 002f1628c6 JGit v5.1.11.201909031202-r
Change-Id: I288acf670160b9bcd2d04f572a902b5838b4d4f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 18:01:55 +02:00
Matthias Sohn 5e24753ab0 Prepare 5.6.0-SNAPSHOT builds
Change-Id: I9eceb7b1272b27b979144041c75eb09ab4eeca6b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-29 10:08:52 +02:00
Matthias Sohn d5a0d76ed0 Prepare 5.5.0-SNAPSHOT builds
Change-Id: Ib498303c8787a5fbee89377eaed332a5a6b4f3b0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-28 21:14:09 +02:00
Matthias Sohn e0ea41b500 JGit v5.5.0.201908280940-m3
Change-Id: I0920767979d7927bc18f3e395963aeebae5ea540
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-28 15:40:54 +02:00
Jonathan Tan f78446b56f Merge "RevWalk: Traverse all parents of UNINTERESTING commits" 2019-08-26 19:05:41 -04:00
Alex Spradlin a80df5380f RevWalk: Traverse all parents of UNINTERESTING commits
When firstParent is set, RevWalk traverses only the first parent of a
commit, even though that commit is UNINTERESTING. Since we want the
maximal UNINTERESTING set, we shouldn't prune any parents here. This
issue is apparent only when some of the commits being traversed are
unparsed, since walker.carryFlagsImpl() propagates the UNINTERESTING
flag to all parsed ancestors, masking the issue.

Therefore teach RevWalk to traverse all parents when a commit is
UNINTERESTING and not only the first parent. Since this issue is
masked by commit parsing, also test situations when the commits
involved are unparsed.

Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
Change-Id: I95e2ad9ae8f1f50fbecae674367ee7e0855519b1
2019-08-26 15:53:42 -07:00
Matthias Sohn 66567df4e2 Add missing package dependency to org.junit.runners.model
b9d2926d missed to add this dependency used in
SeparateClassloaderTestRunner which broke the build in Eclipse.

Change-Id: I7ef79021ad41cabc9f2fa10ac6916eed2745d2c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-25 11:35:34 +02:00
Matthias Sohn 85a1d8bcf8 Prepare 5.4.3-SNAPSHOT builds
Change-Id: Iaf5140446dcf86a50bdb1a30860dfd624d3ec337
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 22:10:41 +02:00
Matthias Sohn 2c0f02244c JGit v5.4.2.201908231537-r
Change-Id: I1d808c63db81435173987c399c90bda7bc5c8d9d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 21:36:24 +02:00
Nail Samatov b9d2926df4 Fix error occurring when SecurityManager is enabled
It's expected that jgit should work without native git installation.
In such case Security Manager can be configured to deny access to the
files outside of git repository. JGit tries to find cygwin
installation. If Security manager restricts access to some folders
in PATH, it should be considered that those folders are absent
for jgit.
Also JGit tries to detect if symbolic links are supported by OS. If
security manager forbids creation of symlinks, it should be assumed
that symlinks aren't supported.

Bug: 550115
Change-Id: Ic4b243cada604bc1090db6cc1cfd74f0fa324b98
Signed-off-by: Nail Samatov <sanail@yandex.ru>
2019-08-23 20:38:26 +03:00
Matthias Sohn f30382b191 Prepare 5.3.5-SNAPSHOT builds
Change-Id: Ic0b9dfcac814ac7584e5eb19105f46344a10465a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:44:04 +02:00
Matthias Sohn 06309fdc43 JGit v5.3.4.201908231101-r
Change-Id: Ia98f47d9a10d6b8cccca6b697230dad4f350d720
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:01:29 +02:00
Matthias Sohn 418722df34 Prepare 5.1.11-SNAPSHOT builds
Change-Id: I8608580424d0e523dcace63f83ae530ba78dbb15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 15:55:45 +02:00
Matthias Sohn 1c44bf8caf JGit v5.1.10.201908230655-r
Change-Id: I68d15ebd6054bdeaf62e14cddb87724828db7943
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 13:38:56 +02:00
Matthias Sohn 2eb83f4b4a Prepare 5.4.2-SNAPSHOT builds
Change-Id: I5b2fde2d69ef1cc11b085874ab783ba48e070470
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 18:26:36 +02:00
Matthias Sohn 0af59e1212 JGit v5.4.1.201908211225-r
Change-Id: Ifa99b930bd20a9bc10696c414c73ebde0cd4b0c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 18:17:59 +02:00
Matthias Sohn bbf3da1aac Prepare 5.3.4-SNAPSHOT builds
Change-Id: I1ccfeb28e87d13b25a8892947e62f1151130b6a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 17:45:59 +02:00
Matthias Sohn e9fcf1932e JGit v5.3.3.201908210735-r
Change-Id: I799859e47616af0ac5ee3a982cb9350d141681d7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 13:30:43 +02:00
Matthias Sohn edc67125b7 Prepare 5.1.10-SNAPSHOT builds
Change-Id: If10afc8e663299a15db8c5fd0574fb51bf7e7ae9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 11:51:41 +02:00
Matthias Sohn 38adb548c3 JGit v5.1.9.201908210455-r
Change-Id: Iaade207292acb8b27e01aca7e1af97ad7db1e854
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 10:52:10 +02:00
Matthias Sohn 3e2c88199f Merge branch 'stable-5.4'
* 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>
2019-08-20 00:16:11 +02:00
Matthias Sohn 35d99477b8 Merge branch 'stable-5.3' into stable-5.4
* 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>
2019-08-20 00:10:15 +02:00
Matthias Sohn 18fb58ae05 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  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: If0c5010a2cf151ebebb2f2088fac3ee02c5007b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-19 23:41:17 +02:00
Matthias Sohn 0eea7368e2 Merge branch 'stable-5.1' into stable-5.2
* 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>
2019-08-19 18:30:35 +02:00
Matthias Sohn f383206ace Cache user global and system-wide git configurations
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>
2019-08-18 11:47:26 +02:00
Matthias Sohn 7f92a70fb3 Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock
FS determines FileStore attributes in a background thread and tries to
save the results to the global git configuration. This competed with
LocalDiskRepositoryTestCase#setup trying to save changes to the same
file requiring the same lock. This frequently led to one of the threads
failing to acquire the lock.

Fix this by first initiating determination of FileStore attributes which
then uses a MockSystemReader not using a userConfig stored to disk which
avoids this race for the lock.

Change-Id: I30fcd96bc15100f8ef9b2a9eb3320bb5ace97c67
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-16 16:51:45 +02:00
Matthias Sohn 9add6d3e24 Implement toString in MockSystemReader and MockConfig
This helps when debugging.

Change-Id: I3d72e1ea207ba60be77a7a9a840abb71ade1271c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-11 00:06:03 +02:00
Matthias Sohn c28167e103 Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader
FS#getFileStoreAttributes used the real userConfig and not the mocked
one. This led to test errors when running tests with Bazel since it
sandboxes tests which prevents they can write to ~/.gitconfig.

Fix this by first preparing the MockedSystemReader and the mocked config
before calling FS#getFileStoreAttributes.

Also fix ConfigTest which broke due to this change since it inherits
from LocalDiskRepositoryTestCase and calls its setup method which was
changed here. We can no longer assert by comparing plain text since FS
adds FileStoreAttributes to the mocked userConfig. Also the default
options seen by this test changed since we now use a mocked config.

Change-Id: I76bc7c94953fe979266147d3b309a68dda9d4dfe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-11 00:06:03 +02:00
Matthias Sohn 65cee6ccbf Override FileBasedConfig's save method in MockConfig
This ensures we don't try to persist MockConfig using its superclasses
save() method which fails with an NPE since MockConfig has no backing
file.

Change-Id: Ifba2d24c9438bb30d3828ed31a4c131f940b45eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-10 23:57:21 +02:00
Matthias Sohn 3cea3676c7 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>
2019-08-09 14:32:02 +02:00
Matthias Sohn 8f7e851346 [error prone] suppress AmbiguousMethodReference in AnyObjectId
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: I5e29c97f4db3e11770be589a6ccd785e2c9ac7f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 23:39:23 +02:00
Matthias Sohn f54db4a857 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  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: Iec3ad6ccc194582cb844310dc172c3103dae4457
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 13:24:14 +02:00
Matthias Sohn 718555518d 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>
2019-08-08 13:04:38 +02:00
Matthias Sohn 0046b2a8fe Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  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: Ia57385b2a60f48a5317c8d723721c235d7043a84
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 11:54:56 +02:00
Matthias Sohn d45219baac Persist minimal racy threshold and allow manual configuration
To enable persisting the minimal racy threshold per FileStore add a
new config option to the user global git configuration:

- Config section is "filesystem"
- Config subsection is concatenation of
  - Java vendor (system property "java.vendor")
  - Java version (system property "java.version")
  - FileStore's name, on Windows we use the attribute volume:vsn instead
    since  the name is not necessarily unique.
  - separated by '|'
  e.g.
    "AdoptOpenJDK|1.8.0_212-b03|/dev/disk1s1"
  The same prefix is used as for filesystem timestamp resolution, so
  both values are stored in the same config section
- The config key for minmal racy threshold is "minRacyThreshold" as a
  time value, supported time units are those supported by
  DefaultTypedConfigGetter#getTimeUnit
- measure for 3 seconds to limit runtime which depends on hardware, OS
  and Java version being used

If the minimal racy threshold is configured for a given FileStore the
configured value is used instead of measuring it.

When the minimal racy threshold was measured it is persisted in the user
global git configuration.

Rename FileStoreAttributeCache to FileStoreAttributes since this class
is now declared public in order to enable exposing all attributes in one
object.

Example:

[filesystem "AdoptOpenJDK|11.0.3|/dev/disk1s1"]
	timestampResolution = 7000 nanoseconds
	minRacyThreshold = 3440 microseconds

Change-Id: I22195e488453aae8d011b0a8e3276fe3d99deaea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Also-By: Marc Strapetz <marc.strapetz@syntevo.com>
2019-08-06 14:54:39 +02:00
Matthias Sohn 5911521ba6 Measure minimum racy interval to auto-configure FileSnapshot
By running FileSnapshotTest#detectFileModified we found that the sum of
measured filesystem timestamp resolution and measured clock resolution
may yield a too small interval after a file has been modified which we
need to consider racily clean. In our tests we didn't find this behavior
on all systems we tested on, e.g. on MacOS using APFS and Java 8 and 11
this effect was not observed.

On Linux (SLES 15, kernel 4.12.14-150.22-default) we collected the
following test results using Java 8 and 11:

In 23-98% of 10000 test runs (depending on filesystem type and Java
version) the test failed, which means the effective interval which needs
to be considered racily clean after a file was modified is larger than
the measured file timestamp resolution.

"delta" is the observed interval after a file has been modified but
FileSnapshot did not yet detect the modification:

"resolution" is the measured sum of file timestamp resolution and clock
resolution seen in Java.

Java version    filesystem  failures resolution  min delta   max delta
1.8.0_212-b04   btrfs	    98.6%       1 ms        3.6 ms      6.6 ms
1.8.0_212-b04   ext4        82.6%       3 ms        1.1 ms      4.1 ms
1.8.0_212-b04   xfs         23.8%       4 ms        3.7 ms      3.9 ms
1.8.0_212-b04   zfs         23.1%       3 ms        4.8 ms      5.0 ms
11.0.3+7        btrfs       98.1%       3 us        0.7 ms      4.7 ms
11.0.3+7        ext4        98.1%       6 us        0.7 ms      4.7 ms
11.0.3+7        xfs         98.5%       7 us        0.1 ms      8.0 ms
11.0.3+7        zfs         98.4%       7 us        0.7 ms      5.2 ms

Mac OS
1.8.0_212       APFS        0%          1 s
11.0.3+7        APFS        0%          6 us

The observed delta is not distributed according to a normal gaussian
distribution but rather random in the observed range between "min delta"
and "max delta".

Run this test after measuring file timestamp resolution in
FS.FileAttributeCache to auto-configure JGit since it's unclear what
mechanism is causing this effect.

In FileSnapshot#isRacyClean use the maximum of the measured timestamp
resolution and the measured "delta" as explained above to decide if a
given FileSnapshot is to be considered racily clean. Add a 30% safety
margin to ensure we are on the safe side.

Change-Id: I1c8bb59f6486f174b7bbdc63072777ddbe06694d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-06 14:54:35 +02:00
Matthias Sohn 902935c38c Reuse FileUtils to recursively delete files created by tests
Replace redundant complex implementation of recursive delete by the one
in FileUtils.

Change-Id: Iced1468b96c4f32381a9cf0c651b2bf6a9a9af35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-26 15:53:33 +02:00
Matthias Sohn 773cbb5f63 Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit
Use the same JDT core settings as used in org.eclipse.jgit but ignore
non-externalized strings.

Change-Id: If30013c76a197e571601a8abc882ac6a99592374
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-24 16:21:53 +02:00
Matthias Sohn 376c20f454 Add missing javadoc in org.eclipse.jgit.junit
Change-Id: Ib709ef050bec31c87f542fb2cc977863dda93ef9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-24 16:21:48 +02:00
Matthias Sohn ba5d13ed42 Enhance RepeatRule to report number of failures at the end
In order to enable counting how frequently a test fails if repeated add
option abortOnFailure. If it is true the test aborts on the first
failure. Otherwise it runs the configured number of repetitions and, if
there was any failure, throws a RepeatException reporting how many of
the test repetitions failed.

Change-Id: Ic47de44d4a6273fddf04b9993ad989903efb40c3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-19 14:45:56 +02:00
Matthias Sohn eda2e95fa8 Measure filesystem timestamp resolution already in test setup
This helps to avoid some time critical tests can't prepare the test
fixture intended since measuring timestamp resolution takes time.

Change-Id: Ib34023e682a106070ca97e98ef16789a4dfb97b4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-19 14:45:55 +02:00
Matthias Sohn 95e8264cc8 Use Instant instead of milliseconds for filesystem timestamp handling
This enables higher file timestamp resolution on filesystems like ext4,
Mac APFS (1ns) or NTFS (100ns) providing high timestamp resolution on
filesystem level.

Note:
- on some OSes Java 8,9 truncate milliseconds, see
https://bugs.openjdk.java.net/browse/JDK-8177809, fixed in Java 10
- UnixFileAttributes truncates timestamp resolution to microseconds when
converting the internal representation to FileTime exposed in the API,
see https://bugs.openjdk.java.net/browse/JDK-8181493
- WindowsFileAttributes also provides only microsecond resolution

Change-Id: I25ffff31a3c6f725fc345d4ddc2f26da3b88f6f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-07-18 03:27:52 +02:00
Michael Keppler 4b0c192f2d Fix bundle localization of Apache SSH bundle
The placeholders in manifest and plugin.properties did not match. To
avoid similar issues, all placeholders have been changed to
Bundle-Vendor and Bundle-Name now.

Bug:548503
Change-Id: Ibd4b9bc237b323e614506b97e5fbc99416365040
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-06-21 17:54:06 +02:00
David Pursehouse 6d0168a414 Make inner classes static where possible
As reported by Error Prone:

An inner class should be static unless it references members of its
enclosing class. An inner class that is made non-static unnecessarily
uses more memory and does not make the intent of the class clear.

See https://errorprone.info/bugpattern/ClassCanBeStatic

Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit ee40efcea4)
2019-06-17 07:48:34 +02:00
Matthias Sohn 16fd3feefc Prepare 5.5.0-SNAPSHOT builds
Change-Id: I177d637e552a79014816dc5d2ef5ccda506adb39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-13 03:01:15 +02:00
Matthias Sohn f3b7c2beae Prepare 5.4.1-SNAPSHOT builds
Change-Id: I8620d03c1cd5c1d0ad04e7607553e9aa18def9bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-12 17:35:11 +02:00
Matthias Sohn 3dad0682be JGit v5.4.0.201906121030-r
Change-Id: Ie68828af68d07cf8e3fe778d39436f539f1c73d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-12 16:29:11 +02:00
Matthias Sohn 0e9361f066 JGit v5.4.0.201906120450-r
Change-Id: Iea17cba848d4e53d69d34e952a2476c375721aa4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-12 10:50:14 +02:00
Matthias Sohn d9c569b747 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Prepare 5.3.3-SNAPSHOT builds
  JGit v5.3.2.201906051522-r
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Update API filters for methods added to fix bugs
  Bazel: Increase severity of most error-prone checks to ERROR
  Enable error-prone checks by default
  Add bazel options to align with gerrit's
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Ie1c7e4752661aec9e1754660934921224e2408eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-06 17:14:31 +02:00
Matthias Sohn fcfe1299c3 Prepare 5.3.3-SNAPSHOT builds
Change-Id: Idebf272835cb22c21257c88b414ada802629b665
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-05 23:35:14 +02:00
Matthias Sohn d6c7c42a1b JGit v5.3.2.201906051522-r
Change-Id: I41b4926f4bfa896ef2a13c35e93e08071ae949a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-05 21:23:13 +02:00
Matthias Sohn 60d65bbd22 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Id79a3a19f9a31dff94d10a406c2b6e08a506931a
2019-06-05 21:18:47 +02:00
Matthias Sohn 4018709eb9 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters

Change-Id: I3ac77bfa03f7436de12ab86e1bba29afee5ccd01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-05 20:58:16 +02:00
Matthias Sohn 57ccca75e6 Prepare 5.1.9-SNAPSHOT builds
Change-Id: I60571e4e0bea04bb2c25ef3d0332a9ab6895db06
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-05 15:23:56 +02:00
Matthias Sohn 2fe587fcfd JGit v5.1.8.201906050907-r
Change-Id: Iae0ffe161df2ca8a800d21688d6b7d7419dfb640
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-05 15:06:56 +02:00
Christian Halstrick b2ee9cfbc3 Enhance fsTick() to use filesystem timer resolution
RepositoryTestCase.fsTick() was was waiting 64, 128, 256, ... milliseconds
until it detected that the filesystem timer has ticked. Make use of
the filesystemtimer resolution information in FS to sleep a fraction
of the filesystem timer resolution. That raises probability to wake up
shortly after the filesystem timer has ticked.

Change-Id: Ibcc38576e42ece13b2fd4423a29c459eed167a69
2019-06-05 00:48:07 +02:00
Matthias Sohn 0988276746 Prepare 5.4.0-SNAPSHOT builds
Change-Id: I9df6fccee253d4087f9afab4cb46e0a40b8a5699
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 22:52:43 +02:00
Matthias Sohn 72998dd5ee JGit v5.4.0.201905221418-m3
Change-Id: I8a7e687acfcf8c341abd726ae60b5ee173422215
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 20:18:14 +02:00
Matthias Sohn b513b77477 Measure file timestamp resolution used in FileSnapshot
FileSnapshot.notRacyClean() assumed a worst case filesystem timestamp
resolution of 2.5 sec (FAT has a resolution of 2 sec). Instead measure
timestamp resolution to avoid unnecessary IO caused by false positives
in detecting the racy git problem caused by finite filesystem timestamp
resolution [1].

Cache the measured resolution per FileStore since timestamp resolution
depends on the respective filesystem type. If timestamp resolution
cannot be measured or fails due to an exception fallback to the worst
case FAT timestamp resolution and avoid caching this value.

Add a 10% safety margin in FileSnapshot.notRacyClean(), though running
FsTest.testFsTimestampResolution() 1000 times which is not using a
safety margin didn't fail on Mac using APFS and Java 8, 11, 12.

Measured Java file timestamp resolution: [2]

[1] https://github.com/git/git/blob/master/Documentation/technical/racy-git.txt
[2] https://docs.google.com/spreadsheets/d/1imy0y6WmRqBf0kjCxzxj2X7M50eIVfa7oaUIzEOHmjo

Bug: 546891
Change-Id: I493f3b57b6b306285ffa7d392339d253e5966ab8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:13:22 +02:00
Carsten Hammer 84fc5c908d Convert to lambda or member reference
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>
2019-05-16 02:58:43 -04:00
Matthias Sohn 1342942cc8 Prepare 5.3.2-SNAPSHOT builds
Change-Id: Iedd56602acc89783387098c7f92ce0e5bad091e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-28 00:54:08 +02:00
Matthias Sohn 38049a008d JGit v5.3.1.201904271842-r
Change-Id: If3c323acfd2b6933f7d4fbec480cd4e82224f701
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-28 00:41:59 +02:00
Matthias Sohn a72e0b0188 Prepare 5.2.3-SNAPSHOT builds
Change-Id: I6ae3db901d986467128326073d4ba70406ae8385
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-24 00:04:44 +02:00
Matthias Sohn 1d297c3ddc JGit v5.2.2.201904231744-r
Change-Id: I4ed2aff28bff702a8c1b42814acb04c7ef9025a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-23 23:43:50 +02:00
Matthias Sohn c2945bd261 Prepare 5.1.8-SNAPSHOT builds
Change-Id: I331bbaefd42ef94673ae8565c9b2b3af9eadfda0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 10:51:17 +02:00
Matthias Sohn 22e41cfd56 JGit v5.1.7.201904200442-r
Change-Id: Ifaa3a88c5e117912a8c691b8b8369dd9a17faebb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 10:42:58 +02:00
Carsten Hammer 6e03645ad8 Use jdk 5 for loop
Replace simple uses of Iterator with a corresponding for-loop.
Also add missing braces on loops as necessary.

Change-Id: I708d82acdf194787e3353699c07244c5ac3de189
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 19:33:13 +02:00
Carsten Hammer c0268f899e Join catch sections using multicatch
Change-Id: I1a9112e6a4f938638c599b489cb0858eca27ab91
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 18:53:58 +02:00
Carsten Hammer 0db509f7e7 Use String.isEmpty() instead of comparing to ""
Use of String.equals("") can be replaced with with String.length() == 0
(for JDK5 and lower) or String.isEmpty() (for JDK6 and higher)

Change-Id: Id1462d22c5d249485d87993263a9239809e73c55
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-11 11:48:31 +09:00