Commit Graph

8618 Commits

Author SHA1 Message Date
Matthias Sohn 05cd1fa5c7 Enable using JMH annotation processor on Java>=9
See
- https://issues.apache.org/jira/browse/MCOMPILER-369
- https://stackoverflow.com/questions/53927874/jmh-doesnt-run-inside-a-java-module-unable-to-find-the-resource-meta-inf-ben

Change-Id: Ie810092399d9fe540e5c2e243d3fdb19493c6bcb
2021-09-29 17:13:04 +02:00
Matthias Sohn 72b89b4b63 Update errorprone to 2.9.0 and enable using it on java 16
Enabling <fork>true</fork> and setting the --add-exports= flags is
required on JDK 16 due to JEP 396: Strongly Encapsulate JDK Internals by
Default.

see https://errorprone.info/docs/installation
and https://openjdk.java.net/jeps/396

Change-Id: I03c257ffb48f429dd7d49a403d65c700abe133ca
2021-09-29 17:13:03 +02:00
Matthias Sohn 9ba3a521aa [errorprone] fix ReturnValueIgnored in PushCertificateStore#next
Change-Id: I8deb7fa702bb973436b7ca21edf3634a087047b7
2021-09-29 17:13:02 +02:00
Matthias Sohn f3eff2308f [errorprone] NameRevCommand: remove ignored call of #toString
This fixes errorprone error: [ReturnValueIgnored] Return value of
'toString' must be used.

Change-Id: I90d2725ae16725a053179322cfaab18cab7b8e68
2021-09-29 17:13:02 +02:00
Matthias Sohn 1d280db147 Enable compiler option --release
This ensures the compiler compiles against the public, supported and
documented API for a specific VM version (here 11) [1]. This also means
that
we don't need EE descriptors in Eclipse anymore in order to ensure that
only supported APIs of the selected Java version can be used.

According to [2] if option --release is used --source and --target
options can't be used.

While we are at it also add default value for all new jdt core options
added in Eclipse 4.21.

[1] https://docs.oracle.com/en/java/javase/11/tools/javac.html
[2] https://docs.oracle.com/en/java/javase/14/docs/specs/man/javac.html#option-release

Change-Id: I852a5d7b0a3210751c15d79ec91915b4c01c41e2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-09-29 17:13:01 +02:00
Matthias Sohn f81a3fc91a Bump minimum required Java version to 11
Bug: 569917
Change-Id: Ifdcdb022a3f29321b4d10da1cc34acca68ed7b03
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-09-29 17:12:12 +02:00
Han-Wen Nienhuys 5f8c484136 reftable: drop code for truncated reads
The reftable format is a block based format, but allows for variably
sized blocks. This obviously happens for reflog blocks (which are zlib
compressed), but is also accepted for index blocks: In the spec, this
is motivated as

     To achieve constant O(1) disk seeks for lookups the index must be
     a single level, which is permitted to exceed the file's
     configured block size, but not the format's max block size of
     15.99 MiB.

Hence, when parsing a block, one cannot be sure of its exact size:
after reading a default-size block (eg. 4kb), the block header may
state that the block is in fact larger.

Before, the code would mark the block as `truncated`, noting

     // Its OK during sequential scan for an index block to have been
     // partially read and be truncated in-memory. This happens when
     // the index block is larger than the file's blockSize. Caller
     // will break out of its scan loop once it sees the blockType.

This looks like either

* a remnant of never-implemented functionality. There is no reason to
  ever sequentially scan an index block.

* alluding to sequential scan of the data blocks before the index
  blocks (eg. scanning refs, which ends when we find the first ref index
  block, and we can then ignore the index block).

This comment is followed by code that populates the
restartTbl/restartCnt fields relative to the (possibly truncated)
buffer. If the buffer is truncated, this essentially reads garbage,
leading to OOB array access when using the index block.

Fix this by dropping the truncated logic and issuing a second read if
the first read was short.

Add a test.

We have never observed this failure scenario at Google. We use 64kb
blocksize, which requires us to need fewer index entries. The reftable
spec mentions an Android repo of size 36M. With 64kb blocks, that's
just 562 index entries. Even with historical growth, we are long from
requiring an index whose size exceeds a single block.

When adding the analogous test for seeking refs, there was no failure.
This points to another possibility which is that the code tries to
avoid writing large index blocks for refs.

I did not investigate further which one it is.

Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=576250

Bug: 576250
Change-Id: I41ec21fac9e526ef57b3d6fb57b988bd353ee338
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2021-09-28 20:35:02 +02:00
Han-Wen Nienhuys b4782d74fd reftable: pass on invalid object ID in conversion
Before, while trying to determine if an object ID was a tag or not,
the reftable conversion would yield an exception.

Change-Id: I3688a0ffa9e774ba27f320e3840ff8cada21ecf0
2021-09-27 11:30:13 -04:00
Matthias Sohn 9c3190ce7a Update eclipse-jarsigner-plugin to 1.3.2
Change-Id: Id5d05d96c392913de7b4451421c2ffb7b63ab83f
(cherry picked from commit c70c0acb47)
2021-09-27 11:28:33 -04:00
Matthias Sohn 283c23012f Fix running benchmarks from bazel
add missing dependency to
- javaewah
- slf4j-api

Change-Id: I28dc982791b32f10d20b2fd0671aa8d2514a0fb3
2021-09-27 16:50:15 +02:00
Matthias Sohn c70c0acb47 Update eclipse-jarsigner-plugin to 1.3.2
Change-Id: Id5d05d96c392913de7b4451421c2ffb7b63ab83f
2021-09-24 00:19:00 +02:00
Matthias Sohn 26d36848fe Add org.bouncycastle.bcutil to p2 repository
Bug: 575621
Change-Id: I57de7af9f9b236cac570d9c10c3d1c3886720868
2021-09-20 17:09:34 +02:00
Matthias Sohn 211900aafd Update maven plugins
- maven-enforcer-plugin 3.0.0
- maven-javadoc-plugin 3.3.1
- maven-pmd-plugin 3.15.0
- org.eclipse.cbi.maven.plugins:eclipse-jarsigner-plugin 1.3.2
- org.springframework.boot:spring-boot-maven-plugin 2.5.4

Change-Id: I377732b651f3718060c58ca48993e0c3ac79fa8b
2021-09-15 01:16:38 +02:00
Matthias Sohn 5334586d24 Removed unused API filters
Change-Id: I39f7173879f64b1cd508990927d4e732f345724e
2021-09-15 00:57:37 +02:00
Matthias Sohn ceecbd4a82 Merge "Merge branch 'next'" 2021-09-14 18:14:02 -04:00
Ivan Frade db032edd8f Merge "RepoCommand: Move building the index for base repos to its own method" 2021-09-14 15:58:08 -04:00
Matthias Sohn ed805cfec6 Merge branch 'next'
* next:
  Enable CommitCommand to use a fluent style
  Prepare 6.0.0-SNAPSHOT builds

Change-Id: Ibd247d5990983bedadd8b959a82215914d216ed1
2021-09-14 00:15:31 +02:00
Matthias Sohn a19494b735 Merge branch 'master' into next
* master: (38 commits)
  Revert "DFS block cache: Refactor to enable parallel index loading"
  GitServlet: allow to override default error handlers
  Silence API error for new interface method ProtocolV2Hook#onObjectInfo
  transport: add object-info capability
  Ignore IllegalStateException if JVM is already shutting down
  Update orbit to R20210825222808 for 2021-09
  Update spotbugs-maven-plugin to 4.3.0
  Update ant to 1.10.11 also in pom.xml
  DFS block cache: add additional stats to DfsReaderIoStats
  Update Orbit to S20210817231813
  [gpg] Better GPG home directory determination
  FS: cleanup use of final modifier
  Ensure FS#searchPath only selects executable files
  RevWalk: getMergedInto's result is wrong on the second call
  DFS block cache: Refactor to enable parallel index loading
  [test] Create keystore with the keytool of the running JDK
  [gpg] Update to Bouncy Castle 1.69
  [test] Create keystore with the keytool of the running JDK
  [sshd] Minor code clean-up
  Support commit.template config property
  ...

Change-Id: I9f99e9a513a23c0c0d252334e79c351512d7355e
2021-09-13 23:53:34 +02:00
Matthias Sohn 1987c25a59 Merge branch 'stable-5.13'
* stable-5.13:
  Prepare 5.13.1-SNAPSHOT builds
  JGit v5.13.0.202109080827-r
  Prepare 5.13.0-SNAPSHOT builds
  JGit v5.13.0.202109011149-rc1
  Prepare 5.13.0-SNAPSHOT builds
  JGit v5.13.0.202108250949-m3

Change-Id: I54ccb4bef74c929a440f77939aea0cc5b1da2181
2021-09-09 14:42:28 +02:00
Matthias Sohn 81cd70d5d0 Prepare 5.13.1-SNAPSHOT builds
Change-Id: Ib2f689d8d13eab022da5b5e83d6d6bebc1bb81d3
2021-09-08 20:24:36 +02:00
Matthias Sohn b3d51a399e JGit v5.13.0.202109080827-r
Change-Id: If3b2d4256712cc7e577c23e75c0d4ad940870e72
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-09-08 14:27:06 +02:00
Matthias Sohn e296af1697 Merge branch 'master' into stable-5.13
* master:
  Revert "DFS block cache: Refactor to enable parallel index loading"

Change-Id: Ifd7cf7a366bf682da6e92ac9dd416bd88e9f1654
2021-09-04 11:45:33 +02:00
Minh Thai a3a8de3108 Revert "DFS block cache: Refactor to enable parallel index loading"
This reverts commit 3cd7eb1b23.

Change-Id: I71ce68ce19503f0f9ad83069dc53eba6ab2c489b
Signed-off-by: Minh Thai <mthai@google.com>
2021-09-03 14:15:42 -07:00
Matthias Sohn efdc03e164 Prepare 5.13.0-SNAPSHOT builds
Change-Id: I2a1d7ab24d5ca718348f4ce3cda351553e48cd1f
2021-09-01 20:00:56 +02:00
Matthias Sohn 4949a295df JGit v5.13.0.202109011149-rc1
Change-Id: Id8d0970102f18e61a2fc7cf941267c9089d71c1a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-09-01 16:49:12 +02:00
Matthias Sohn 6fc54671e0 Merge branch 'master' into stable-5.13
* master:
  GitServlet: allow to override default error handlers
  Silence API error for new interface method ProtocolV2Hook#onObjectInfo
  transport: add object-info capability
  Ignore IllegalStateException if JVM is already shutting down
  Update orbit to R20210825222808 for 2021-09
  RevWalk: getMergedInto's result is wrong on the second call

Change-Id: I007882d0c663e406d8845cc807f3792ae7673230
2021-09-01 16:31:13 +02:00
Matthias Sohn 35aaca1efb Merge branch 'stable-5.12'
* stable-5.12:
  GitServlet: allow to override default error handlers

Change-Id: I4710cec30c58d7a6525a42dc5f1fdffc912ed073
2021-09-01 16:23:47 +02:00
Matthias Sohn c0380e9cdd Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  GitServlet: allow to override default error handlers

Change-Id: I65c01857ab42ec3023da16e6816d58e1a36e40e4
2021-09-01 16:22:21 +02:00
Matthias Sohn 5a3569f04b Merge branch 'stable-5.10' into stable-5.11
* stable-5.10:
  GitServlet: allow to override default error handlers

Change-Id: If10a99bcdc91105059b15a1d137dd38af228c58d
2021-09-01 16:08:03 +02:00
Matthias Sohn 738ef7782d Merge branch 'stable-5.9' into stable-5.10
* stable-5.9:
  GitServlet: allow to override default error handlers

Change-Id: I55273087f8a67762130728eaaf635519c25255b3
2021-09-01 15:55:58 +02:00
Antonio Barone 8470771510 GitServlet: allow to override default error handlers
GitServlet delegates repository access over HTTP to the GitFilter
servlet.

GitServlet, in turn, can be extended by jgit consumers to provide custom
logic when handling such operations.

This is the case, for example, with Gerrit Code Review, which provides
custom behavior with a GitOverHttpServlet [1].

Among possible customizations, the ability of specifying a custom error
handler for UploadPack and ReceivePack was already introduced in
GitFilter by Idd3b87d6b and I9c708aa5a2, respectively.

However the `setUploadPackErrorHandler` and `setReceivePackErrorHandler`
methods were never added to the GitServlet.

Expose the `setUploadPackErrorHandler` and `setReceivePackErrorHandler`
methods to the GitServlet, so that consumers of the jgit library might
specify custom error handlers.

[1] https://gerrit.googlesource.com/gerrit/+/refs/heads/stable-3.2/java/com/google/gerrit/httpd/GitOverHttpServlet.java#95

Change-Id: I712d485ff68b662b48c71ef75650c5a155950d23
2021-09-01 15:25:30 +02:00
Matthias Sohn 525127ebb4 Silence API error for new interface method ProtocolV2Hook#onObjectInfo
Change-Id: Ie4d09db2b89f26bc6ceb4e84f10c7e66b0ff684f
2021-09-01 14:50:48 +02:00
Bruno Albuquerque 5b8e387c67 transport: add object-info capability
Sometimes it is useful to obtain metadata associated with an object
without the need to first download it locally. This is specially useful
when using partial clones.

This change implements the object-info capability that allows clients to
query the remote server for object metadata (currently only size). This
is a backport of the same capability that was recently added to the Git
project a2ba162cda (object-info: support for retrieving object info,
2021-04-20).

Signed-off-by: Bruno Albuquerque <bga@google.com>
Change-Id: I4dc9828e1c247f08b0976b8810be92d124366165
2021-08-31 14:36:06 -07:00
Ivan Frade 9951dce84d RepoCommand: Move building the index for base repos to its own method
Minor refactor, clearing the way to adjust the exceptions.

Change-Id: I0a669d77a1cb1daf22bd258d8ff08a40783ff44f
2021-08-31 14:12:25 -07:00
Matthias Sohn c1961ad809 Merge branch 'stable-5.12'
* stable-5.12:
  RevWalk: getMergedInto's result is wrong on the second call

Change-Id: Iee51703b2b009df15c0d8ee19fd480058b665bce
2021-08-30 22:25:02 +02:00
Matthias Sohn 6817b7e3b4 Ignore IllegalStateException if JVM is already shutting down
Trying to register/unregister a shutdown hook when the JVM is already in
shutdown throws an IllegalStateException. Ignore this exception since we
can't do anything about it.

Bug: 575367
Change-Id: Ic967c16c7f566c84778795315ab369e76668b364
2021-08-29 05:02:59 -04:00
Matthias Sohn c697f02e12 Update orbit to R20210825222808 for 2021-09
Change-Id: I5a98f2134d19c3495d7d39cccfd7cf6f07640bd5
2021-08-26 20:42:26 +02:00
Matthias Sohn 574e899051 Prepare 5.13.0-SNAPSHOT builds
Change-Id: I6db044fdd57b60adbc2dd078c4af8cb54bb331c3
2021-08-25 22:33:09 +02:00
Matthias Sohn a38ea8ede7 JGit v5.13.0.202108250949-m3
Change-Id: Icc079b28327f5a02256f9a06837c2be6352ea6e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-08-25 15:49:20 +02:00
Marco Miller 8911bd0827 Update spotbugs-maven-plugin to 4.3.0
Change-Id: Iafb680923cbc6c81067773159a9a0e2fcdc60169
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2021-08-24 17:46:16 -04:00
Matthias Sohn 1ca106f07a Update ant to 1.10.11 also in pom.xml
This was missed when the target platform was updated to use ant 1.10.11
in cf9baedb5d.

Change-Id: I0d503fa4b27df73a7dad68f1b729346596d78332
2021-08-24 10:54:46 +02:00
Alina Djamankulova 8173c16785 DFS block cache: add additional stats to DfsReaderIoStats
New stats are populated in DfsPackFile to provide details about loading
pack, bitmap and reverse indexes.

Signed-off-by: Alina Djamankulova <adjama@google.com>
Change-Id: Ib6e8384ecc31821261e5099d0768c0b1227e8364
2021-08-24 04:16:22 -04:00
Matthias Sohn cf9baedb5d Update Orbit to S20210817231813
and org.apache.ant to 1.10.11.v20210720-1445

Change-Id: Ic9c2f42628e47fffc99a07d591bc465b4e24b86e
2021-08-23 11:53:15 +02:00
Thomas Wolf ca7a30f231 [gpg] Better GPG home directory determination
GPG can use customized directories instead of the standard ~/.gnupg or
%APPDATA%\gnupg directories:

* Environment variable GNUPGHOME can define the location.
* On Windows, a registry key may define the location (but this is
  deprecated).
* Portable installations may use a directory defined via a file
  "gpgconf.ctl".
* GPG programs may take a --homedir command-line argument, which
  overrides anything.

Implement handling of environment variable GNUPGHOME. The other ways of
GPG to get its home directory are outside the reach of JGit. Provide a
system property "jgit.gpg.home" that the user can set in such cases.

Do tilde replacement for the system property and for GNUPGHOME.

Note that on VMS, the default directory would be ~/gnupg (without dot).
This is not accounted for, but a user on VMS could now use either the
system property or GNUPGHOME to direct JGit to the right directory.

Bug: 575327
Change-Id: Id5ea04a85d58dba0c0df7a705777630d36042467
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-08-18 08:57:14 +02:00
Matthias Sohn aad1bde522 FS: cleanup use of final modifier
See the contributor guide [1].

[1] https://wiki.eclipse.org/EGit/Contributor_Guide#Use_of_the_.22final.22_modifier

Change-Id: I4673442310a3a53d838407f7eb11964144bb04d0
2021-08-17 16:48:19 +02:00
Matthias Sohn 5fb71fb54e Ensure FS#searchPath only selects executable files
On Posix non executable files on the path should be ignored, on Windows
File#canExecute always returns true.

While we are here also add missing braces.

Bug: 575385
Change-Id: I80cd5057bdf9632a17f103db6f1356e975b6e150
2021-08-17 16:48:19 +02:00
kylezhao 35eeab41b3 RevWalk: getMergedInto's result is wrong on the second call
Make sure the future user can reset all UNINTERESTING commmits after
this operation.

Signed-off-by: kylezhao <kylezhao@tencent.com>
Change-Id: I7549b9ff67bd31acd5dfc92331cb9a30b47b8278
2021-08-13 10:51:16 +08:00
Alina Djamankulova 3cd7eb1b23 DFS block cache: Refactor to enable parallel index loading
With this change bitmap index creation is not blocked on index and
reverse index full initialization in DfsPackFile. Now bitmap index and index could be
read from storage in parallel in separate threads.

Update PackBitmapIndexV1 constructor to get packIndex and reverseIndex
suppliers instead of actual objects. Inner class IdxPositionBitmap was added to initialize pack objects after bitmap
index is fully read from storage. Update DfsPackFile and PackBitmapIndex
accordingly.

Signed-off-by: Alina Djamankulova <adjama@google.com>
Change-Id: Iea59ab58501b2acbbf9263412982ec9c6898a7ee
2021-08-12 14:51:18 -04:00
Thomas Wolf 1825a2230c Merge branch 'stable-5.12'
* stable-5.12:
  [test] Create keystore with the keytool of the running JDK
  Fix garbage collection failing to delete pack file
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I4b54f4850819736144edb784617ee902f491ffd6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-07-29 18:19:23 +02:00
Thomas Wolf 65de0d4863 Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: Ie8db450a1fad05bddb812a55b2ceb03b2805403a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-07-29 13:12:13 +02:00