Commit Graph

8547 Commits

Author SHA1 Message Date
Thomas Wolf ff3c3d8ff5 Fix bad indentation in pom.xml
Change-Id: I683f190d6914fb48f32cc3b3f0910b4264c7d725
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-10-24 21:35:51 +02:00
Thomas Wolf 6640baf57d Minor code-clean-up in OpenSshConfigFile
Change-Id: I45d50198e43aeb2a56c74026de7ee8c1a30f9d10
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-10-24 21:35:51 +02:00
Matthias Sohn 4b4a95b1bb Remove use of deprecated getAllRefs() in UploadPack
Repository.getAllRefs() is deprecated and should not
be used anymore.

Bug: 534731
Change-Id: I037a9b901275bfa7952b4c79861d7639c9d42715
2021-10-23 07:31:08 -04:00
Alina Djamankulova 3b960ae72d DFS block cache: fix lock issue and support parallel index loading
This change is a fix to http://git.eclipse.org/r/c/jgit/jgit/+/183562
that was reverted in http://git.eclipse.org/r/c/jgit/jgit/+/184978
due to deadlocks. Separate locks in DfsBlockFile are removed to rely
on getting value from DfsBlockCache with region locking in place.

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.

A unit test is added for parallel index loading.

Signed-off-by: Alina Djamankulova <adjama@google.com>
Change-Id: Ic6d9c5a4a254628636aa98a5008447a27a003f69
2021-10-19 15:01:59 -07:00
Thomas Wolf c0436a3a0a Merge changes I1f180d7f,I04415f07
* changes:
  JSch: fix service publication for ServiceLoader
  Set JSch global config values only if not set already
2021-10-19 05:38:54 -04:00
Thomas Wolf f698fbf919 JSch: fix service publication for ServiceLoader
The file name in META-INF/services must be the fully qualified
interface name; the content the fully qualified implementation class
name.

This was broken in commit 9683bc71.

Add a test for the default factory being found by the ServiceLoader.

Change-Id: I1f180d7f60e5c1e74a39bbd9a5f0099bd8343e21
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-10-19 09:32:20 +02:00
Thomas Wolf f8b0c00e6a Set JSch global config values only if not set already
Bug: 576604
Change-Id: I04415f07bf2023bc8435c097d1d3c65221d563f1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-10-19 09:07:14 +02:00
Matthias Sohn 8a3158c551 Merge branch 'stable-5.13'
* stable-5.13:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  Fix RevWalk.getMergedInto() ignores annotated tags
  Optimize RevWalk.getMergedInto()
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2
  Add org.bouncycastle.bcutil to p2 repository

Change-Id: I789e3c84045cc9dcd8a26de34d09fc1e3ccc41e7
2021-10-15 23:10:12 +02:00
Matthias Sohn 78043b07e2 Merge branch 'stable-5.12' into stable-5.13
* stable-5.12:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  Fix RevWalk.getMergedInto() ignores annotated tags
  Optimize RevWalk.getMergedInto()
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: Ie5da8d2d07f39ab5aaeca560040637635d4eb04c
2021-10-15 22:58:21 +02:00
Matthias Sohn 91e44e08cf Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I2122b3966bddb10d43d439eb8c5d6cc4583c6ba6
2021-10-15 22:48:01 +02:00
Matthias Sohn 4060936bdd Merge branch 'stable-5.10' into stable-5.11
* stable-5.10:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I23ccb89306263ce042ce782d881812d4b5187672
2021-10-15 22:45:18 +02:00
Matthias Sohn 50411fa147 Merge branch 'stable-5.9' into stable-5.10
* stable-5.9:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I4e7c7727ebfa9a7748477f2300bd66d775548ad6
2021-10-15 22:32:00 +02:00
Saša Živkov d160e8a935 Fix missing peel-part in lsRefsV2 for loose annotated tags
We observed the following issue:

  $ git tag -a v1.0 -m v1.0
  $ git push origin tag v1.0
  $ git ls-remote origin v1.0^{}
  ... empty result ...

  On the server (Gerrit) side run git-gc to pack the refs:
  $ git gc

  Repeat the ls-remote from the client and the result is correct:
  $ git ls-remote origin v1.0^{}
  7ad85c810de3ae922903d4bdd17c53cd627260ba        refs/tags/v1.0^{}

Unfortunately, the existing UploadPackTest didn't reveal this issue
although it provided the test case needed to do so: testV2LsRefsPeel.
This is because The UploadPackTest uses InMemoryRepository which
internally uses Dfs* implementations. The issue is only reproducible
when using the FileRepository.

It is a non-trivial task to refactor the UploadPackTest to work against
both InMemoryRepository and FileRepository and this change is not trying
to do that. This change creates a new test:
UploadPackLsRefsFileRepositoryTest and copies the necesssary code from
the UploadPackTest.

Change-Id: Icfc7d0ca63f1524bafe24c9626ce12ea72aa3718
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
2021-10-15 22:29:28 +02:00
Alina Djamankulova 7d4f3c22ab DFS block cache: allow multiple passes for blocks before eviction
Let certain pack extensions that are expensive to load from storage
(e.g. pack index, bitmap index) stay in DFS block cache longer than
others by overriding default cache count through DfsBlockCacheConfig

Don't change default behavior when cache override map is empty. Use int
cacheCount instead of boolean hot for Ref<T>

Signed-off-by: Alina Djamankulova <adjama@google.com>
Change-Id: I18062784ec9cc14dbba3e4bb8d9509440cf2d44f
2021-10-08 14:35:01 +02:00
kylezhao 60b81c5a92 Fix RevWalk.getMergedInto() ignores annotated tags
If an annotated tag refers to a commit, we should not ignore it.

Change-Id: I77504f93636e9e984540e7d8535ef301adce6a80
Signed-off-by: kylezhao <kylezhao@tencent.com>
2021-10-08 12:05:48 +02:00
kylezhao c5b3054735 Optimize RevWalk.getMergedInto()
Transitive Relation Definition:
On the DAG of commit history, if A can reach B, C can reach A, then C
can reach B.

Example:
As is shown in the graph below:

  1 - 2 - 3 - 4 (side)
            \
             5 -  6^ (master) - 7 (topic)

Find out which branches is 2 merged into:
After we calculated that master contains 2, we can mark 6 as TEMP_MARK
to avoid unwanted walks.
When we want to figure out if 2 is merge into the topic, the traversal
path would be [7, 6] instead of [7, 6, 5, 3, 2].

Test:
This change can significantly improve performance for tags.
On a copy of the Linux repository, the command 'git tag --contains
<commit>' had the following performance improvement:

commit      | Before   | After   | Rel %
47a44d27ca  | 29251ms  | 6687ms  | -77%
90327e7dff  | 21388ms  | 6256ms  | -70%
f85fac0efa  | 11150ms  | 7338ms  | -34%

The current version ignores tags, even though the tag is a type of
the ref.
Follow-up commits I'll fix it.

Change-Id: Ie6295ca4d16070499912af462239e679a97cce47
Signed-off-by: kylezhao <kylezhao@tencent.com>
Reviewed-by: Christian Halstrick <christian.halstrick@sap.com>
Reviewed-by: Martin Fick <mfick@codeaurora.org>
2021-10-08 12:05:47 +02:00
kylezhao 578b6a79a3 GarbageCollectCommand: add numberOfBitmaps to statistics
Change-Id: I630afac9408c7313d1cecb1b24476f645c94fc27
Signed-off-by: kylezhao <kylezhao@tencent.com>
2021-10-08 11:12:31 +08:00
Matthias Sohn 5a7a5d5ae9 Merge branch 'stable-5.8' into stable-5.9
* stable-5.8:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I9e66ef90dc9a65bac47b35705d679bf992bd72b9
2021-10-08 00:36:14 +02:00
Matthias Sohn 721a971d5d Merge branch 'stable-5.7' into stable-5.8
* stable-5.7:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I88c47ff57f4829baec5b19aad3d8d6bd21f31a86
2021-10-08 00:33:33 +02:00
Matthias Sohn 4fd8c1406f Merge branch 'stable-5.6' into stable-5.7
* stable-5.6:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I1c18f5f435f4a4a86e0548a310dbfc74191e1ed5
2021-10-08 00:18:42 +02:00
Thomas Wolf 4657e7a99a Rename a local variable
To avoid a warning about a name clash with the field.

Change-Id: Ib1950486a9c63647e4240a268a3c9a7d613f3303
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-09-30 17:16:30 +02:00
Thomas Wolf bdba9edd5f Remove redundant type arguments
In Java 11 type arguments for anonymous subclasses can be inferred
and don't need to be specified. This resolves a number of compiler
warnings.

Change-Id: I55eff3babb7628aa0627085e65a1b45eb12c2cd3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-09-30 09:31:12 +02:00
Matthias Sohn 3d86d3e810 Delete old target platforms and corresponding Orbit releases
We updated the baseline target platform to jgit-4.17 corresponding to
Eclipse 4.17 (2020-09). Delete all target platforms older than this
version and the corresponding Orbit releases.

Change-Id: I93b2d8585bdc3c3312264d34657ceaf3f4a27bd5
2021-09-29 17:13:07 +02:00
Matthias Sohn 39d4daefd2 Update tycho to 2.5.0 and target platform to jgit-4.17
jgit-4.17 corresponds to Eclipse 2020-09, which is the first Eclipse
version that required Java 11, and which is JGit's new baseline as of
JGit 6.0.

Remove pack200 which is deprecated in Java 11 and isn't supported by
tycho 2.5.0 anymore. It was specified in JSR 200 (J2SE 1.5) [1],
deprecated in JEP 336 (Java SE 11) [2] and removed in JEP 367 (Java SE
14) [3].

[1] https://www.jcp.org/en/jsr/detail?id=200
[2] https://openjdk.java.net/jeps/336
[3]	https://openjdk.java.net/jeps/367

Change-Id: I12c196586397779d2be81d2374207703e3fc5dbf
2021-09-29 17:13:07 +02:00
Matthias Sohn e4550807a3 Update ecj to 3.27.0
Change-Id: Ia3845a14d8169595425fd435ef3ef09c08e82f53
2021-09-29 17:13:06 +02:00
Matthias Sohn 1aa19c67e6 Replace XMLReaderFactory deprecated since Java 9
Change-Id: Ie8a9d411fc19e8b7bf86c0b4df0b02153a0e9444
2021-09-29 17:13:06 +02:00
Matthias Sohn 81771d8625 IndexDiffWithSymlinkTest: handle InaccessibleObjectException
On Java 16 this test throws InaccessibleObjectException, handle and
ignore it similar to IllegalAccessException.

Change-Id: I19b4f577579694a146516861a7ec567141f3464b
2021-09-29 17:13:05 +02:00
Matthias Sohn 9683bc71b6 Fix split package in bundle org.eclipse.jgit.ssh.jsch
The package org.eclipse.jgit.transport was split between
org.eclipse.jgit and org.eclipse.jgit.ssh.jsch.

Bug: 564544
Change-Id: I91d38e67c65ed97a880f8dc8f9559663b9eec33b
2021-09-29 17:13:05 +02:00
Matthias Sohn 68a638deb0 KeyGrip: fix build error on java 15
CryptlibObjectIdentifiers can't be used because bouncycastle doesn't
export the package org.bouncycastle.asn1.cryptlib.

Bug: 573638
Change-Id: I1f9e2af02d9fec69d2249a7d78301ba4b333a9ba
2021-09-29 17:13:04 +02:00
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