]> source.dussan.org Git - jgit.git/log
jgit.git
4 years agoAdd missing @since tag for ReceivePack#receiveWithExceptionPropagation 64/153864/1
Matthias Sohn [Thu, 5 Dec 2019 00:51:29 +0000 (01:51 +0100)]
Add missing @since tag for ReceivePack#receiveWithExceptionPropagation

Change-Id: Ie64abc3e5bcf6dbaecfa8f2cb50796703ebd1f39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.7.0-SNAPSHOT builds 63/153863/1
Matthias Sohn [Thu, 5 Dec 2019 00:32:59 +0000 (01:32 +0100)]
Prepare 5.7.0-SNAPSHOT builds

Change-Id: I7efa0cd08dee711d6fefc3e6bb478a3cb11fe85c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge branch 'stable-5.6' 62/153862/1
Matthias Sohn [Thu, 5 Dec 2019 00:31:32 +0000 (01:31 +0100)]
Merge branch 'stable-5.6'

* stable-5.6:
  Introduce RefDatabase#hasFastTipsWithSha1
  Update Orbit to R20191126223242 for 2019-12
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201912041214-rc1
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201911271000-m3

Change-Id: Id33b054131bbcd27a0ae7200f564775049698d2c

4 years agoIntroduce RefDatabase#hasFastTipsWithSha1 43/152843/13
Han-Wen Nienhuys [Mon, 18 Nov 2019 00:29:16 +0000 (16:29 -0800)]
Introduce RefDatabase#hasFastTipsWithSha1

The reftable format supports fast inverse (SHA1 => ref) queries.

If the ref database does not support fast inverse queries, it may be
advantageous to build a complete SHA1 to ref map in advance for
multiple uses. To let applications decide, this function indicates
whether the inverse map is available.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Idaf7e01075906972ec21332cade285289619c2b3

4 years agoUpdate Orbit to R20191126223242 for 2019-12 50/153850/1
Matthias Sohn [Wed, 4 Dec 2019 21:41:13 +0000 (22:41 +0100)]
Update Orbit to R20191126223242 for 2019-12

Change-Id: I205d4f4a529f34c15a1afb4c791088a8e22986f0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.6.0-SNAPSHOT builds 43/153843/1
Matthias Sohn [Wed, 4 Dec 2019 21:13:56 +0000 (22:13 +0100)]
Prepare 5.6.0-SNAPSHOT builds

Change-Id: I5e737ff7f262fdd43fc975a0b3594c8b33919663
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.6.0.201912041214-rc1 24/153824/1 v5.6.0.201912041214-rc1
Matthias Sohn [Wed, 4 Dec 2019 17:14:43 +0000 (18:14 +0100)]
JGit v5.6.0.201912041214-rc1

Change-Id: I5ed21fbc5f83096bf0b79f2aa751db415cbcc7e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge changes I1f968649,Ied678797
Terry Parker [Mon, 2 Dec 2019 23:21:33 +0000 (18:21 -0500)]
Merge changes I1f968649,Ied678797

* changes:
  UploadPackServlet: Use uploadWithExceptionPropagation
  GitSmartHttpTools: Do not use sideband when sending an error

4 years agoserver: Add a custom error handler 62/152362/3
Masaya Suzuki [Fri, 8 Nov 2019 18:48:03 +0000 (10:48 -0800)]
server: Add a custom error handler

Same as UploadPack, add a custom error handler.

Change-Id: I9c708aa5a22e01214c1d997fa6f72f4b8bf814f0
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Add methods that do not handle exceptions 61/152361/2
Masaya Suzuki [Fri, 8 Nov 2019 18:31:16 +0000 (10:31 -0800)]
transport: Add methods that do not handle exceptions

Same as UploadPack. These methods do not handle exceptions and the
caller can handle them. This makes it possible to customize the error
handling.

Change-Id: Ia5203f80133cb5b3e5d754859b4167ac920eaf14
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Let users specify an error handler for unpacking a pack file 60/152360/2
Masaya Suzuki [Fri, 8 Nov 2019 18:12:20 +0000 (10:12 -0800)]
transport: Let users specify an error handler for unpacking a pack file

Currently, there's no way for a user to customize the error handler for
the exception happened during unpacking an incoming pack file. Create an
error handler class and let them specify one.

Change-Id: Id07638ee58c88e1365181c3ddd17ee0266f3934d
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoReceivePack: Use try-with-resources for PostReceiveHook 59/152359/2
Masaya Suzuki [Fri, 8 Nov 2019 03:07:57 +0000 (19:07 -0800)]
ReceivePack: Use try-with-resources for PostReceiveHook

Instead of dropping a second exception, use try-with-resources so that
exception thrown by a hook is attached as a suppressed exception.

This removes a need of holding an exception that is thrown while
unpacking an incoming packfile.

Change-Id: I74d8b944931abbf53d9d1ae5db2e889639fba027
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Consolidate status reporting code 58/152358/2
Masaya Suzuki [Fri, 8 Nov 2019 02:52:17 +0000 (18:52 -0800)]
transport: Consolidate status reporting code

BaseReceivePack#sendStatusReport anyway needs to know
CAPABILITY_REPORT_STATUS. By moving this flag to BaseReceivePack,
simplify the status reporting code.

Change-Id: Iaa0878b1fc13057b687a7f01d25c85fd78c0423e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Add ReceiveCommandErrorHandler 57/152357/2
Masaya Suzuki [Fri, 8 Nov 2019 02:22:17 +0000 (18:22 -0800)]
transport: Add ReceiveCommandErrorHandler

This gives a chance to handle an exception for a user. For example, when
an IOException is thrown while executing
`walk.parseAny(cmd.getNewId())`, it's always handled as
REJECTED_MISSING_OBJECT. However, IOException can mean a Git storage IO
error. By introducing an error handler class, a user can add a custom
error handler for these cases.

Change-Id: I3e03a536e1d8e137cb0f6e596d71642e72adde9e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Move exception handler to the caller 56/152356/2
Masaya Suzuki [Fri, 8 Nov 2019 01:40:25 +0000 (17:40 -0800)]
transport: Move exception handler to the caller

Move exception handling code to the caller side. This is a preparation
for adding a custom error handler that is similar to UploadPack.

Note that `catch (Throwable t)` will not affect the exception spec since
Java will do an analysis of rethrown exceptions. See
https://docs.oracle.com/javase/8/docs/technotes/guides/language/catch-multiple.html.

Change-Id: I973a63d4b079c2cd1402afb3f2956e18b7d5a00c
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Move handling code to the caller side 54/152354/2
Masaya Suzuki [Fri, 8 Nov 2019 01:15:57 +0000 (17:15 -0800)]
transport: Move handling code to the caller side

This removes a raw IOException at one level. Later we'll add a custom
exception handling mechanism like UploadPack.

Change-Id: I52a7423798c97b032d848351be8b6f144776b017
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoUploadPackServlet: Use uploadWithExceptionPropagation 64/152364/2
Masaya Suzuki [Fri, 8 Nov 2019 22:30:29 +0000 (14:30 -0800)]
UploadPackServlet: Use uploadWithExceptionPropagation

As UploadPackErrorHandler's Javadoc says, UploadPackServlet should have
called uploadWithExceptionPropagation and let UploadPackErrorHandler to
handle the exception. Fix UploadPackServlet.

Change-Id: I1f9686495fcf3ef28598ccdff3e6f76a16c8bca3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoGitSmartHttpTools: Do not use sideband when sending an error 63/152363/2
Masaya Suzuki [Fri, 8 Nov 2019 22:40:19 +0000 (14:40 -0800)]
GitSmartHttpTools: Do not use sideband when sending an error

Unlike ReceivePack, the V0/V1 UploadPack response does not support
sideband except for the packfile parts. By sending an error in a
sideband packet, the JGit client says "Expected ACK/NACK, got: ...".

Use an error packet always. The recent Git clients will understand it
better than out-of-context sideband packets.

Change-Id: Ied6787973d3b6860c0b95c7910d4e4312bb7a184
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoPrepare 5.6.0-SNAPSHOT builds 08/153508/1
Matthias Sohn [Wed, 27 Nov 2019 20:25:38 +0000 (21:25 +0100)]
Prepare 5.6.0-SNAPSHOT builds

Change-Id: I1e52d2dfb202b87ecb9d0273deaa2c8d8ce1864e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.6.0.201911271000-m3 91/153491/1 v5.6.0.201911271000-m3
Matthias Sohn [Wed, 27 Nov 2019 15:01:20 +0000 (16:01 +0100)]
JGit v5.6.0.201911271000-m3

Change-Id: I3810892c2bed947e4dfaa615a7b4d93eeb46abb9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge "ReceivePack: Open visibility for some methods"
Jonathan Nieder [Wed, 27 Nov 2019 04:56:40 +0000 (23:56 -0500)]
Merge "ReceivePack: Open visibility for some methods"

4 years agoReceivePack: Open visibility for some methods 24/152924/5
Ivan Frade [Tue, 19 Nov 2019 06:45:19 +0000 (22:45 -0800)]
ReceivePack: Open visibility for some methods

This partially reverts Ic6bb5e66. It made private some methods in
ReceivePack that were protected before. At least two of those methods
(#init and #receivePackAndCheckConnectivity) are used by out-of-tree
subclasses for tracing and testing.

Make ReceivePack#init() and ReceivePack#receivePackAndCheckConnectivity
protected again to allow tracing and testing.

Change-Id: I7ff22c091fbfc2d94009c449d58e7c5ac9f4f759
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agoJGit pgm: Format blame output to match canonical git 31/147131/13
Thomas Wolf [Tue, 6 Aug 2019 16:32:35 +0000 (18:32 +0200)]
JGit pgm: Format blame output to match canonical git

Canonical git shows the zero-Id for lines without commit, and
uses the current time stamp for such lines.

Also consider lines without commit when calculating the field
widths.

Change-Id: If0bee9b3e7f90861ad0f387f68e52ecc4a53dfd7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMake blame work correctly on merge conflicts 30/147130/13
Thomas Wolf [Tue, 6 Aug 2019 16:31:35 +0000 (18:31 +0200)]
Make blame work correctly on merge conflicts

When a conflicting file was blamed, JGit would not identify lines
coming from the merge parents. The main cause for this was that
Blame and BlameCommand simply added the first DirCacheEntry found
for a file to its queue of candidates (blobs or commits) to consider.
In case of a conflict this typically is the merge base commit, and
comparing a auto-merged contents against that base would yield
incorrect results.

Such cases have to be handled specially. The candidate to be
considered by the blame must use the working tree contents, but
at the same time behave like a merge commit/candidate with HEAD
and the MERGE_HEADs as parents. Canonical git does something very
similar, see [1].

Implement that and add tests.

I first did this for the JGit pgm Blame command. When I then tried
to do the same in BlameCommand, I noticed that the latter also
included some fancy but incomplete CR-LF handling. In order to
be able to use the new BlameGenerator.prepareHead() also in
BlameCommand this CR-LF handling was also moved into BlameGenerator
and corrected in doing so.

(Just considering the git config settings was not good enough,
CR-LF behavior can also be influenced by .gitattributes, and even
by whether the file in the index has CR-LF. To correctly determine
CR-LF handling for check-in one needs to do a TreeWalk with at
least a FileTreeIterator and a DirCacheIterator.)

[1] https://github.com/git/git/blob/v2.22.0/blame.c#L174

Bug: 434330
Change-Id: I9d763dd6ba478b0b6ebf9456049d6301f478ef7c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge branch 'stable-5.5' 83/153383/1
David Pursehouse [Tue, 26 Nov 2019 08:44:48 +0000 (17:44 +0900)]
Merge branch 'stable-5.5'

* stable-5.5:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie32c3bae056fb0745892e6c20ad37d4994542d96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.4' into stable-5.5 82/153382/1
David Pursehouse [Tue, 26 Nov 2019 08:44:06 +0000 (17:44 +0900)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: I3dd2554cbad5bb224c2799b6b133fe91ab10abc3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.3' into stable-5.4 81/153381/1
David Pursehouse [Tue, 26 Nov 2019 08:43:20 +0000 (17:43 +0900)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: I21878c42fd9abf7d858b534300df0fffe4bad431
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.2' into stable-5.3 80/153380/1
David Pursehouse [Tue, 26 Nov 2019 08:42:10 +0000 (17:42 +0900)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie5e66f2e26c057c81101b0d110f91ea479eb362d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.1' into stable-5.2 79/153379/1
David Pursehouse [Tue, 26 Nov 2019 08:41:04 +0000 (17:41 +0900)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ic1dc84a6c4a1cf430d329627642583fd6e0d0eaa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBazel: Use java_plugin and java_binary from @rules_java in jmh.bzl 64/153364/2
David Pursehouse [Tue, 26 Nov 2019 03:17:52 +0000 (12:17 +0900)]
Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl

Change-Id: I80456f74bc17a1ebb0248fce8050a4cb07bf18f1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBazel: Add missing newlines at end of BUILD files 63/153363/2
David Pursehouse [Tue, 26 Nov 2019 03:16:47 +0000 (12:16 +0900)]
Bazel: Add missing newlines at end of BUILD files

Change-Id: I11afc45141da988e28382898246995f6b45eb09c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade maven-enforcer-plugin to 3.0.0-M3 57/153357/2
David Pursehouse [Tue, 26 Nov 2019 00:17:55 +0000 (09:17 +0900)]
Upgrade maven-enforcer-plugin to 3.0.0-M3

Change-Id: Ie6b090ada9bcb36e018b0f991c09307f79655ba4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge changes I8698001d,I5c1177ac
Jonathan Nieder [Tue, 26 Nov 2019 01:56:23 +0000 (20:56 -0500)]
Merge changes I8698001d,I5c1177ac

* changes:
  Add missing license header to ReftableDatabase
  Add missing license header to UploadPackRefSortingForReachabilityTest

4 years agoAdd missing license header to ReftableDatabase 61/153361/1
Jonathan Nieder [Tue, 26 Nov 2019 01:42:59 +0000 (17:42 -0800)]
Add missing license header to ReftableDatabase

When this class was split from DfsReftableDatabase in commit
2b1e942729617c45d2cb03b7556ab3d63253f64f (reftable: split off generic
code from DFS code, 2019-09-26), we forgot to carry over the license
header.

Change-Id: I8698001dfb69f58784df643ef0185ab2d55e52aa
Reported-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
4 years agoAdd missing license header to UploadPackRefSortingForReachabilityTest 60/153360/2
Jonathan Nieder [Tue, 26 Nov 2019 01:37:40 +0000 (17:37 -0800)]
Add missing license header to UploadPackRefSortingForReachabilityTest

Forgot to add this in commit 989a927a5f0aa21745d560e77e9eb7c76682c117
(checkNotAdvertisedWants: Be lazy convering Ref to RevCommit,
2019-11-20).

Change-Id: I5c1177ac60eabb3a71959bbad4537e076a901b7e
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years ago[spotbugs] Fix potential NPE in FSTest 59/153359/1
Matthias Sohn [Tue, 26 Nov 2019 00:48:43 +0000 (01:48 +0100)]
[spotbugs] Fix potential NPE in FSTest

Change-Id: I6ca37d045642e3aada7e6b42b3cb8c3bba014455
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove unused import in CreateFileSnapshotBenchmark 58/153358/1
Matthias Sohn [Tue, 26 Nov 2019 00:14:47 +0000 (01:14 +0100)]
Remove unused import in CreateFileSnapshotBenchmark

Change-Id: Ic02f32fb882602e573f34d0a38d850f43aadf7ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRepositoryCache: don't require HEAD in git repositories 42/152842/8
Han-Wen Nienhuys [Sun, 17 Nov 2019 23:05:57 +0000 (15:05 -0800)]
RepositoryCache: don't require HEAD in git repositories

Reftable-enabled repositories don't have a file called HEAD. Check for
reftable/ instead.

This fixes repository creation on reftable in Gerrit.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I778c2be01d96aaf135affae4b457b5fe5b483bee

5 years agoFileRepository: cleanup refs outside refs/ on reftable conversion 14/153014/5
Han-Wen Nienhuys [Wed, 20 Nov 2019 03:55:06 +0000 (19:55 -0800)]
FileRepository: cleanup refs outside refs/ on reftable conversion

Change-Id: Iab7d3a08906e826e26572f534512a09d3a5876b0
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge "UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed"
Jonathan Nieder [Tue, 26 Nov 2019 00:40:50 +0000 (19:40 -0500)]
Merge "UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed"

5 years agoUpdate Orbit to S20191118194249 for 2019-12 M3 54/153354/1
Matthias Sohn [Mon, 25 Nov 2019 22:57:24 +0000 (23:57 +0100)]
Update Orbit to S20191118194249 for 2019-12 M3

Change-Id: I22426309dec6caabd26abb1eb31bdbff945d220c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSilence API error for new method in ReachabilityChecker 52/153352/2
Matthias Sohn [Mon, 25 Nov 2019 22:41:04 +0000 (23:41 +0100)]
Silence API error for new method in ReachabilityChecker

Following OSGi semantic versioning which tolerates breaking implementers
in a minor release.

Change-Id: I4600c5ee9cd4ae209b69870a5d1367f83678617e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed 83/153283/1
David Pursehouse [Mon, 25 Nov 2019 00:31:49 +0000 (09:31 +0900)]
UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed

Change-Id: I6042c401fff55325128d47e7e9098fc7e60d501d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBitmappedReachabilityChecker: Use only one bitmap for the whole check 02/152702/16
Ivan Frade [Thu, 14 Nov 2019 21:56:27 +0000 (13:56 -0800)]
BitmappedReachabilityChecker: Use only one bitmap for the whole check

The checker is creating a new bitmap per branch leading to excessive
memory consumption. For the reachability check one bitmap with the
reachability of all branches aggregated is enough.

Build the reachability bitmap with a filter. The filter itself uses it
to emit only commits not reached before and the caller to check what
targets have been reached already.

BitmapCalculator is not required anymore.

Change-Id: Ic5c62f77fe0f188913215b7eaa51d849a9aae6a5
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agocheckNotAdvertisedWants: Be lazy converting Ref to RevCommit 89/152989/8
Ivan Frade [Tue, 19 Nov 2019 20:08:53 +0000 (12:08 -0800)]
checkNotAdvertisedWants: Be lazy converting Ref to RevCommit

The ref points to an ObjectId that then is translated into a RevCommit.
This translation can be costly and with the incremental reachability
check is probably not needed for most of the elements.

Delay the translation from ObjectId to RevCommit to when it is needed.
Use Streams, that have the laziness built-in, all the way from Ref to
RevCommit.

This should reduce the latency for reachability checks over big sets of
references.

Change-Id: I28693087321b2beff3eaa1f3d2e7840ab0eedc6d
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoReachabilityChecker: Receive a Stream instead of a Collection 88/152988/6
Ivan Frade [Tue, 19 Nov 2019 18:40:21 +0000 (10:40 -0800)]
ReachabilityChecker: Receive a Stream instead of a Collection

Preparatory change. Converting ObjectIds to RevCommits is potentially
expensive and in the incremental reachability check, it is probably not
required for all elements in the collection.

Pass a Stream to the reachability checker. In the follow up we make
the conversion from ObjectId to RevCommit in the stream (i.e. on
demand). This should reduce the latency of reachability checks over big
sets of references.

Change-Id: I9f310e331de5b0bf8de34143bd7dcd34316d2fba
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUploadPack: Prioritize references for non-advertised wants checks 32/152532/6
Ivan Frade [Tue, 12 Nov 2019 22:33:29 +0000 (14:33 -0800)]
UploadPack: Prioritize references for non-advertised wants checks

UploadPack needs to check if object ids that weren't advertised before
are reachable from the references visible to the user. In the
bitmap-based reachability check, this is done incrementally: checking
against one reference, if anything remaining adding a second and so on.
It is more efficient to check first more common references (e.g. refs/heads/*)

Sort the references for the reachability checker. This should solve the
connectivity earlier and require less bitmap creation and less memory.

Change-Id: I48ac10d71e29fab2d346479802401eaea4aacb5c
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoReceivePack: Fix name hiding of 'atomic' member 32/152832/1
David Pursehouse [Sun, 17 Nov 2019 18:30:46 +0000 (10:30 -0800)]
ReceivePack: Fix name hiding of 'atomic' member

Change-Id: Ia357d49ca793ff1cb86e7130bc1a5f59590496a9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReceivePack: Remove unnecessarily nested else-clause 31/152831/1
David Pursehouse [Sun, 17 Nov 2019 18:27:05 +0000 (10:27 -0800)]
ReceivePack: Remove unnecessarily nested else-clause

Change-Id: I604ea76e03503300a381eca9c213f73677b5e21f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoSimplify comparator code 28/152828/1
Michael Keppler [Sun, 17 Nov 2019 17:07:09 +0000 (18:07 +0100)]
Simplify comparator code

Use lambda style comparators where possible. They are easier to read.

Change-Id: I5b80cfcd90909c94286742fa83af71015532809f
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoFix typo in Javadoc 27/152827/1
Michael Keppler [Sun, 17 Nov 2019 17:05:46 +0000 (18:05 +0100)]
Fix typo in Javadoc

No functional changes.

Change-Id: Ic7f9bb85806eca2788303c2f808d003cdfc7cc7c
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agopgm: add write stats to BenchmarkReftable 07/152607/21
Han-Wen Nienhuys [Wed, 13 Nov 2019 23:23:01 +0000 (15:23 -0800)]
pgm: add write stats to BenchmarkReftable

Usage:

  git ls-remote https://gerrit.googlesource.com/gerrit > lsr

  bazel build org.eclipse.jgit.pgm:jgit && rm -rf /tmp/reftable* && \
    ./bazel-bin/org.eclipse.jgit.pgm/jgit debug-benchmark-reftable \
    --test write_stack lsr /tmp/reftable

On my Lenovo x250 laptop, this yields about 1ms per ref write.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I31c74a08026ba188a3256ef6862dae9d85e6d5ef

5 years agopgm: add command to convert repo to reftable 35/148735/57
Han-Wen Nienhuys [Thu, 29 Aug 2019 18:18:10 +0000 (20:18 +0200)]
pgm: add command to convert repo to reftable

Change-Id: I2f870699995da164a3e7adec430301ac7a53c425
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agofile: implement FileReftableDatabase 68/146568/92
Han-Wen Nienhuys [Mon, 12 Aug 2019 15:33:51 +0000 (17:33 +0200)]
file: implement FileReftableDatabase

Reftable is a binary, block-based storage format for the ref-database.
It provides several advantages over the traditional packed + loose
storage format:

 * O(1) write performance, even for deletions and transactions.

 * atomic updates to the ref database.

 * O(log N) lookup and prefix scans

 * free from restrictions imposed by the file system: it is
   case-sensitive even on case-insensitive file systems, and has
   no inherent limitations for directory/file conflicts

 * prefix compression reduces space usage for repetitive ref names,
   such as gerrit's refs/changes/xx/xxxxx format.

FileReftableDatabase is based on FileReftableStack, which does
compactions inline. This is simple, and has good median performance,
but every so often it will rewrite the entire ref database.

For testing, a FileReftableTest (mirroring RefUpdateTest) is added to
check for Reftable specific behavior. This must be done separately, as
reflogs have different semantics.

Add a reftable flavor of BatchRefUpdateTest.

Add a FileReftableStackTest to exercise compaction.

Add FileRepository#convertToReftable so existing testdata can be
reused.

CQ: 21007
Change-Id: I1837f268e91c6b446cb0155061727dbaccb714b8
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix Maven missing version warning 92/152792/1
Michael Keppler [Sat, 16 Nov 2019 15:49:38 +0000 (16:49 +0100)]
Fix Maven missing version warning

[WARNING] Some problems were encountered while building the effective
model for org.eclipse.jgit:org.eclipse.jgit.benchmarks:jar:5.6.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-shade-plugin is missing. @ line 131,
column 15

Change-Id: Id25916c460bc4a10d0f797779d24f53292df2b77
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoUse Java 8 source and target in Maven 90/152790/1
Michael Keppler [Sat, 16 Nov 2019 15:23:34 +0000 (16:23 +0100)]
Use Java 8 source and target in Maven

Building the jgit aggregator with Maven leads to a compiler level 1.6
for me, thereby failing the build. Multiple profiles specify
source/target level separately, but there seems no global setting.
Adding the global properties makes the jgit aggregator compile on my
system.

Change-Id: Ia5613cc0fcf6085265a9e48f940e5a7d3f998608
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoReceivePack: Reduce visibility of methods 26/152626/7
David Pursehouse [Thu, 14 Nov 2019 00:40:14 +0000 (16:40 -0800)]
ReceivePack: Reduce visibility of methods

Several methods were protected when they were defined in BaseReceivePack
which has since been squashed into ReceivePack. Those methods no longer
need to be protected, and can now be private instead.

Change-Id: Ic6bb5e66f353fcbdc7919847423234af398c88b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSuppress API error raised for constant added in 345e2648 70/152770/1
Matthias Sohn [Sat, 16 Nov 2019 08:17:32 +0000 (00:17 -0800)]
Suppress API error raised for constant added in 345e2648

Change-Id: I29fb091f27f38c74843d50c2602164fc63ab8a16
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoTopoSortGenerator: simplify first-parent handling 61/151661/3
Thomas Wolf [Sat, 26 Oct 2019 17:46:31 +0000 (19:46 +0200)]
TopoSortGenerator: simplify first-parent handling

Change-Id: I74b40f1a2f81911c1d5ac5ae93b4a160fccf8f73
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoRewriteGenerator: avoid adding null parent 57/151657/4
Thomas Wolf [Fri, 25 Oct 2019 23:00:16 +0000 (01:00 +0200)]
RewriteGenerator: avoid adding null parent

Prevent adding a null parent to a commit's parent array. Doing so
can cause NPEs later on.

Bug: 552160
Change-Id: Ib24b7b9b7b08e0b6f246006b4a4cade7eeb830b9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoDiffFormatter: support core.quotePath = false 10/151710/4
Thomas Wolf [Mon, 28 Oct 2019 17:11:57 +0000 (18:11 +0100)]
DiffFormatter: support core.quotePath = false

core.quotePath = false means that "bytes higher than 0x80 are not
considered "unusal" anymore"[1], i.e., they are not escaped. In
essence this preserves non-ASCII characters in path names in output.

Note that control characters and other special characters in the
ASCII range will still be escaped.

Add a new QuotedString.GIT_PATH_MINIMAL singleton implementing this.
Change the normal GIT_PATH algorithm to use bytes instead of characters
so it can be re-used. Provide a setter in DiffFormatter for the quoting
style so that an application can override the default, which is the
setting from the git config (and by default "true"). Use the new
QuotedString.GIT_PATH_MINIMAL when core.quotePath == false.

[1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath

Bug: 552467
Change-Id: Ifcb233e7d10676333bf42011e32d01a4e1138059
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoIndexDiff/SubmoduleWalk: make the RepositoryBuilder configurable 60/151660/6
Thomas Wolf [Sat, 26 Oct 2019 17:58:07 +0000 (19:58 +0200)]
IndexDiff/SubmoduleWalk: make the RepositoryBuilder configurable

Some applications using JGit use their own repository caching. In
such applications, it may be needlessly inefficient to create new
submodule repositories from a SubmoduleWalk or in an IndexDiff. It
can be much more efficient to use an already cached repository
instance.

Provide a way to configure a SubmoduleWalk with a factory to create
BaseRepositoryBuilders to use to create repositories, and use it in
IndexDiff. Provide new IndexDiff.diff() operations that take such an
additional factory as parameter.

An application that caches Repository instances (for instance EGit)
can use a factory that provides builders that don't create a new
Repository instance but that return the already cached instance, if
one is available. Note that in such a case, the application may need
to be prepared to deal with IndexDiff.diff() also _closing_ the
obtained repository; if the application expects its cached Repository
instances to remain open while being cached, it'll have to use
Repository.incrementOpen() to prevent that the repository instance
gets closed.

Bug: 550878
Change-Id: Icc1b34dfc4cebd8ed4739dd09d37744d41adf711
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoIndexDiff/SubmoduleWalk: handle submodule.<name>.ignore correctly 07/151407/4
Thomas Wolf [Mon, 21 Oct 2019 20:28:50 +0000 (22:28 +0200)]
IndexDiff/SubmoduleWalk: handle submodule.<name>.ignore correctly

IndexDiff would apply ignore mode ALL from .gitmodules to all remaining
submodules, and would ignore other settings from .gitignore and always
apply the setting defined on the IndexDiff instead. Correct that.

In canonical git the ignore setting from .gitmodules can also be
overridden by .git/config.[1] Implement that override in SubmoduleWalk.

[1] https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtignore

Bug: 521613
Change-Id: I9199fd447e41c7838924856dce40678370b66395
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoMerge changes I583491f6,Idd44e3bb
Jonathan Nieder [Thu, 14 Nov 2019 23:21:04 +0000 (18:21 -0500)]
Merge changes I583491f6,Idd44e3bb

* changes:
  Run Eclipse formatter on BatchRefUpdateTest
  Move KetchSystem.delay to FileUtils.

5 years agoRun Eclipse formatter on BatchRefUpdateTest 00/152700/1
Han-Wen Nienhuys [Thu, 14 Nov 2019 21:48:28 +0000 (13:48 -0800)]
Run Eclipse formatter on BatchRefUpdateTest

Change-Id: I583491f621e54401c60150efb285fcc7243a9355
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
5 years agoSuppress the API errors introduced by 3e9a5f99 85/152685/1
Matthias Sohn [Thu, 14 Nov 2019 18:08:24 +0000 (10:08 -0800)]
Suppress the API errors introduced by 3e9a5f99

I1ce92869435d5eebb7d671be44561e69c6233134 merged BaseReceivePack into
ReceivePack which breaks API but is only affecting the few jgit based
servers out in the wild.

Change-Id: Iad856a2afaf3cad95d01ad81a0116cebcd9de2d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoReceivePack: Remove unused getLockMessageProcessName method 25/152625/1
David Pursehouse [Thu, 14 Nov 2019 00:33:34 +0000 (16:33 -0800)]
ReceivePack: Remove unused getLockMessageProcessName method

Change-Id: I85a0c3e3a53f87ad6f6eda41c7c6cb41b403b3bb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReceivePack: Remove unnecessary ReceivePack. prefix on static call 24/152624/1
David Pursehouse [Thu, 14 Nov 2019 00:31:48 +0000 (16:31 -0800)]
ReceivePack: Remove unnecessary ReceivePack. prefix on static call

Change-Id: I2d9a95266f5baa5a2298451adbd9ca0259b26c4b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agotransport: Merge BaseReceivePack into ReceivePack 36/146536/6
Masaya Suzuki [Tue, 23 Jul 2019 19:54:43 +0000 (12:54 -0700)]
transport: Merge BaseReceivePack into ReceivePack

Move the BaseReceivePack implementation back into ReceivePack. This is a
backward-incompatible change. For example, BaseReceivePack.FirstLine no
longer exists and cannot be referenced.  However, most of the code
should just work by replacing BaseReceivePack with ReceivePack.

Although this is an API change, it only affects callers using JGit as a
server, and there are very few of those in the wild.

Change-Id: I1ce92869435d5eebb7d671be44561e69c6233134
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoMove KetchSystem.delay to FileUtils. 88/152588/5
Han-Wen Nienhuys [Wed, 13 Nov 2019 15:12:05 +0000 (07:12 -0800)]
Move KetchSystem.delay to FileUtils.

This will provide exponential backoff with jitter to other JGit
components too.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Idd44e3bbaef6d71134ce2e3f7d405f35e7397cbd

5 years agoBaseReceivePack: Add hasReceivedPack method 97/152597/2
David Pursehouse [Wed, 13 Nov 2019 18:16:25 +0000 (10:16 -0800)]
BaseReceivePack: Add hasReceivedPack method

The getPackSize method will throw IllegalStateException if it is
called when the pack size is not set. This is the case for example
when the received commands are all DELETE and there is no pack.

Add a new method hasReceivedPack that can be called prior to calling
getPackSize, to avoid causing the IllegalStateException.

See [1] for context.

[1] https://bugs.chromium.org/p/gerrit/issues/detail?id=11918

Change-Id: I56397256a05e92c8398e65c07a859cee59b46317
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoSilence API errors for new API introduced in 5.5.2 09/152509/1
Matthias Sohn [Tue, 12 Nov 2019 17:51:22 +0000 (18:51 +0100)]
Silence API errors for new API introduced in 5.5.2

Change-Id: I9fee5138ea8f407d9d34cad4659c3a2d4f3ebf35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpgrade wagon-ssh to 3.3.4 03/152503/1
David Pursehouse [Tue, 12 Nov 2019 16:08:51 +0000 (08:08 -0800)]
Upgrade wagon-ssh to 3.3.4

Change-Id: I6162b72fc06376f33fe34b9fef1c106800e3a920
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.5' 84/152484/1
Thomas Wolf [Tue, 12 Nov 2019 08:43:30 +0000 (09:43 +0100)]
Merge branch 'stable-5.5'

* stable-5.5:
  Fix NPE in SystemReader in tests

Change-Id: I8500caeca99fe05ce9a80b54330b72e23670a46b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoFix NPE in SystemReader in tests 67/152467/1
Thomas Wolf [Tue, 12 Nov 2019 08:38:04 +0000 (09:38 +0100)]
Fix NPE in SystemReader in tests

SystemReader.updateAll() must _not_ test whether the file exists. In
tests at least there are FileBasedConfigs with a null file. Test
configs should (and do) override isOutdated() to deal with this case.

Change-Id: I56303fe0d56afeb9f2203ee807a92c5dcf3809e9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoMerge branch 'stable-5.5' 52/152452/1
Matthias Sohn [Mon, 11 Nov 2019 19:07:01 +0000 (11:07 -0800)]
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>
5 years agoBaseReceivePack: Fix the format 55/152355/2
Masaya Suzuki [Fri, 8 Nov 2019 01:17:21 +0000 (17:17 -0800)]
BaseReceivePack: Fix the format

Change-Id: I6136ef5318f81a6feb1267338ca76e60122fd15b
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoPrepend hostname to subsection used to store file timestamp resolution 40/150740/9
Matthias Sohn [Mon, 7 Oct 2019 17:05:07 +0000 (19:05 +0200)]
Prepend hostname to subsection used to store file timestamp resolution

This ensures the measured filesystem timestamp resolution will be only
used on the machine where it was measured and avoid errors in case the
~/.jgitconfig file is copied to another machine.

Bug: 551850
Change-Id: Iff2a11be62ca94c3bbe4a955182988dc50852f9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoStore filesystem timestamp resolution in extra jgit config 39/150739/9
Matthias Sohn [Mon, 7 Oct 2019 15:58:56 +0000 (17:58 +0200)]
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>
5 years agoUpdate bouncycastle version to 1.64 and Orbit to I20191106190530 95/151295/6
David Ostrovsky [Fri, 18 Oct 2019 08:21:27 +0000 (04:21 -0400)]
Update bouncycastle version to 1.64 and Orbit to I20191106190530

The recent versions fixed number of defects and added new features: [1].
Use Orbit I20191106190530 until a S-build is available.

[1] https://www.bouncycastle.org/releasenotes.html

Change-Id: I0f2fd3a218ea31f6f6b58b1816af9361e4de54e4
Signed-off-by: David Ostrovsky <d.ostrovsky@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSystemReader: extract updating config and its parents if outdated 47/149947/8
Thomas Wolf [Sat, 21 Sep 2019 12:38:22 +0000 (14:38 +0200)]
SystemReader: extract updating config and its parents if outdated

Change-Id: Ia77f442e47c5670c2d6d279ba862044016aabd86
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpgrade maven-jar-plugin to 3.2.0 36/152036/2
David Pursehouse [Tue, 5 Nov 2019 13:49:48 +0000 (22:49 +0900)]
Upgrade maven-jar-plugin to 3.2.0

Change-Id: I74fc2a6b1a79f1433914b909e92e524668817081
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade maven-source-plugin to 3.2.0 35/152035/2
David Pursehouse [Tue, 5 Nov 2019 13:49:16 +0000 (22:49 +0900)]
Upgrade maven-source-plugin to 3.2.0

Change-Id: I0c683e100b64f6d66e2598cb06970a547aaeaed6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.5' 83/152183/1
Matthias Sohn [Wed, 6 Nov 2019 20:07:09 +0000 (21:07 +0100)]
Merge branch 'stable-5.5'

* stable-5.5:
  Fix benchmark pom.xml to include distribution managment config

Change-Id: Ife566e83777e3282892d6f7a90400b00e9065292

5 years agoMerge branch 'stable-5.4' into stable-5.5 82/152182/1
Matthias Sohn [Wed, 6 Nov 2019 20:05:07 +0000 (21:05 +0100)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Fix benchmark pom.xml to include distribution managment config

Change-Id: I1863f641880e8d9fbd26c02ede6bf5d773e8c8a0

5 years agoMerge branch 'stable-5.3' into stable-5.4 81/152181/1
Matthias Sohn [Wed, 6 Nov 2019 20:02:14 +0000 (21:02 +0100)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Fix benchmark pom.xml to include distribution managment config

Change-Id: Ib4eed75cc8c5146884ce1461e98564de1c759bba

5 years agoMerge branch 'stable-5.2' into stable-5.3 80/152180/1
Matthias Sohn [Wed, 6 Nov 2019 20:00:07 +0000 (21:00 +0100)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Fix benchmark pom.xml to include distribution managment config

Change-Id: Icda57b0045ba87d9424615713d7d706697e5c236

5 years agoMerge branch 'stable-5.1' into stable-5.2 79/152179/1
Matthias Sohn [Wed, 6 Nov 2019 19:57:46 +0000 (20:57 +0100)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Fix benchmark pom.xml to include distribution managment config

Change-Id: I20e8b7155397771b1bc77e628f535f27458a24bb

5 years agoFix benchmark pom.xml to include distribution managment config 64/152164/2
Matthias Sohn [Wed, 6 Nov 2019 16:49:48 +0000 (17:49 +0100)]
Fix benchmark pom.xml to include distribution managment config

Also fix indentation.

Change-Id: I6d223c493d537bb8aac23c7ddf0a602aff22a3c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.5' 14/152114/1
Matthias Sohn [Tue, 5 Nov 2019 15:28:06 +0000 (16:28 +0100)]
Merge branch 'stable-5.5'

* stable-5.5:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: If87a13d0f809d9968ad2921b786f4b18e1b494d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.4' into stable-5.5 59/152059/1
Matthias Sohn [Tue, 5 Nov 2019 15:10:48 +0000 (16:10 +0100)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: I071536d630a95e89f5bbbf965a1571b9f5eb81ee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.3' into stable-5.4 56/152056/1
Matthias Sohn [Tue, 5 Nov 2019 14:42:14 +0000 (15:42 +0100)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: Ib735c4039e24ec8b045ae2cc81df1e9e5c9fa996
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.2' into stable-5.3 50/152050/1
Matthias Sohn [Tue, 5 Nov 2019 14:24:54 +0000 (15:24 +0100)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: I00615958ab6fbdff601e87a9792aba5606cda12a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.1' into stable-5.2 73/151973/2
Matthias Sohn [Tue, 5 Nov 2019 14:07:39 +0000 (15:07 +0100)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: If91c55a192d3b2c441d9c8d414f2e24a7261b1b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRun JMH benchmarks using bazel 23/147023/12
Matthias Sohn [Sun, 4 Aug 2019 17:04:41 +0000 (19:04 +0200)]
Run JMH benchmarks using bazel

The benchmarks can be built and run using bazel by running:

$ bazel run //org.eclipse.jgit.benchmarks:benchmarks

Change-Id: I6679750eaa0f2be30ed9d45036e013b0ea4fcc86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoBenchmark for creating files and FileSnapshots 71/147171/7
Matthias Sohn [Wed, 7 Aug 2019 09:51:30 +0000 (11:51 +0200)]
Benchmark for creating files and FileSnapshots

Change-Id: I953fd8b6b9743b0b9cada244331253eb2121784d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoImplement benchmark for looking up FileStore of a given Path 66/147066/7
Matthias Sohn [Mon, 5 Aug 2019 14:26:20 +0000 (16:26 +0200)]
Implement benchmark for looking up FileStore of a given Path

Results on Mac OS 10.14.6 using APFS:

Result "org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore":
  44583.277 ±(99.9%) 2666.096 ns/op [Average]
  (min, avg, max) = (43707.073, 44583.277, 45320.685), stdev = 692.377
  CI (99.9%): [41917.181, 47249.373] (assumes normal distribution)

Secondary result
"org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore:·stack":
Stack profiler:

....[Thread state
distributions]........................................................
100.0%         RUNNABLE

....[Thread state:
RUNNABLE].............................................................
 42.5%  42.5% sun.nio.fs.UnixNativeDispatcher.realpath0
 37.9%  37.9% sun.nio.fs.UnixNativeDispatcher.stat0
 11.0%  11.0% sun.nio.fs.BsdNativeDispatcher.getfsstat
  7.6%   7.6% sun.nio.fs.BsdNativeDispatcher.fsstatEntry
  0.7%   0.7% sun.nio.fs.BsdNativeDispatcher.endfsstat
  0.1%   0.1% sun.nio.fs.UnixPath.initOffsets
  0.0%   0.0% sun.nio.fs.UnixFileAttributes.get
  0.0%   0.0% java.util.zip.Inflater.inflateBytes
  0.0%   0.0% sun.misc.Unsafe.compareAndSwapInt
  0.0%   0.0% sun.nio.fs.BsdFileStore.findMountEntry

This shows that FS.attrCacheByPath should be useful to reduce overhead
of looking up the FileStore of a given file.

Change-Id: I7213086b42e0453f0ee149660d507dac2a4644cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJMH benchmark for SimpleLruCache 22/147022/10
Matthias Sohn [Sat, 3 Aug 2019 10:02:34 +0000 (12:02 +0200)]
JMH benchmark for SimpleLruCache

See [1] for JMH documentation and [2] how to use JMH in Eclipse.

The benchmarks pom currently cannot use the JGit parent pom due to an
ecj bug [3] regarding annotation processing. Hence for now do not
inherit from the JGit parent pom and copy the compiler plugin
configuration for javac from the parent pom.

After running the Maven build the benchmark can be run using Maven:

$ java -jar org.eclipse.jgit.benchmarks/target/benchmarks.jar

or in Eclipse by running the main method of the SimpleLruCacheBenchmark
class.

[1] https://openjdk.java.net/projects/code-tools/jmh/
[2] http://alblue.bandlem.com/Page/3/index.html
[3] https://eclip.se/532029

CQ: 20517
CQ: 20518
Change-Id: Idca8a9e0980f0b8a9c741c4c9e97d03c62f07c8d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate API problem filters 72/151972/1
Matthias Sohn [Mon, 4 Nov 2019 15:24:55 +0000 (16:24 +0100)]
Update API problem filters

- filter errors for new APIs added in service release
- remove unused filters

Change-Id: Ifbf532b8a3c46d4ed78a38f6c75073a072b7f669
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove unused API problem filters 48/151948/1
Matthias Sohn [Mon, 4 Nov 2019 12:28:23 +0000 (13:28 +0100)]
Remove unused API problem filters

Change-Id: I0ae0fd4919b7ccc5218c6eb0fab22350bb9c9714
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>