Commit Graph

9748 Commits

Author SHA1 Message Date
Matthias Sohn 13bea495c7 [errorprone] Express duration using seconds which is clearer
[CanonicalDuration] Duration can be expressed more clearly with
different units.

see https://errorprone.info/bugpattern/CanonicalDuration

Change-Id: I7f358b5adabee1523e56b109a2c81c74ec523b74
2023-09-22 23:31:28 +02:00
Matthias Sohn ec0657ba01 [errorprone] Use ArrayList instead of LinkedList
[JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or
ArrayDeque.

see https://errorprone.info/bugpattern/JdkObsolete

Change-Id: I13fb953f55fc7b6e007d6fd6a6a1bfd377773588
2023-09-22 23:31:28 +02:00
Matthias Sohn b4f4ae472a [errorprone] AddCommand#filepattern: use a more specific type
Variable type can use a more specific type to convey more information to
callers.
	private Collection<String> filepatterns;
	                  ^
    (see https://errorprone.info/bugpattern/PreferredInterfaceType)

Change-Id: I68b74de65aba3bb849ef508d7dcdd8b85b0ab100
2023-09-22 23:31:28 +02:00
Matthias Sohn ebdf71c117 [errorprone] Suppress UnnecessaryParentheses
for the sake of readability.

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

Change-Id: I8444db78c408d4e8bd71bf7e575b9af637900629
2023-09-22 23:31:28 +02:00
Matthias Sohn 4cf246c9ab [errorprone] Remove unnecessary parentheses
see https://errorprone.info/bugpattern/UnnecessaryParentheses

Change-Id: Id08cf0e05b3d35f139fc34e0aa83882555a8a81a
2023-09-22 23:31:27 +02:00
Matthias Sohn d65170603f tools/BUILD: Sort errorprone rules alphabetically
Change-Id: I006940eb8a7710d5b8ea66c6f805f0dd08e62a31
2023-09-22 17:04:19 +02:00
Matthias Sohn 136b8953e2 Update jetty to 10.0.16
Change-Id: I918e308e71fa978c9f25e3fad63c5f2e94ec3be7
2023-09-22 17:04:19 +02:00
Matthias Sohn ff10cd2d81 Update bazel to 6.3.2
With bazel 6.2.0 building the change
I918e308e71fa978c9f25e3fad63c5f2e94ec3be7 fails with this error:

$ bazelisk build all
INFO: Invocation ID: ba94402e-d1db-4920-ad46-58139ef7ca55
INFO: Analyzed target //:all (96 packages loaded, 1961 targets
configured).
INFO: Found 1 target...
ERROR: /Users/xxxxxxx/.cache/bazel/b645215973ac043930fa5900e337e822/external/jetty-util-ajax/jar/BUILD:3:12:
Extracting interface @jetty-util-ajax//jar:jar failed: (Segmentation
fault): ijar failed: error executing command (from target
@jetty-util-ajax//jar:jar)
external/remote_java_tools_darwin_arm64/java_tools/ijar/ijar
external/jetty-util-ajax/jar/jetty-util-ajax-10.0.16.jar ... (remaining
3 arguments skipped)
...

Updating bazel to 6.3.2 fixes this problem.

Release notes for bazel 6.3.2:
https://github.com/bazelbuild/bazel/releases/tag/6.3.2

Change-Id: I4f697b2f9a560732c89e2a0410ae6133e8c382ef
2023-09-22 17:04:18 +02:00
Matthias Sohn 01d6d8a193 DfsPackFile: remove unnecessary @SuppressWarnings("boxing")
Change-Id: I7af999dc4434b7b57bb7e0b84b9b64d24efce220
2023-09-22 17:04:18 +02:00
Matthias Sohn 1924d353ef CommitGraphWriter: Remove unnecessary semicolon
Change-Id: I8ea87d0ff3be8a541e72210f0da7fec1f43008e8
2023-09-22 17:00:15 +02:00
Matthias Sohn 4262150f74 CommitGraphWriter: fix boxing warnings
Change-Id: I35c3a3baadb8d7d73c01252fe4333fa2159722ee
2023-09-22 17:00:15 +02:00
Matthias Sohn c57257bc01 CommitGraphWriter#createCoreChunks: Remove not-thrown exceptions
Change-Id: I0e6f32ed415dc3a0ccadbeae46c979c378ebb0fc
2023-09-22 17:00:14 +02:00
Ivan Frade 2390a89f28 CommitGraphWriter: Decouple Stats from computing bloom filters
The public stats object is created only to be populated by the computation of
bloom filters.

Make the computation return its numbers with the results and copy them
to the stats when needed. This eliminates the side effects from the
computation and makes it easier to add more data to the stats later.

Change-Id: I7a5e55fc3a17f5a294edf3a3b725b2d9c0280a5a
2023-09-21 11:45:04 -07:00
Ivan Frade f1a9d92a30 CommitGraphWriter: Move bloom filter calculation out of createChunks
It looks confusing that the createChunks method calculates bloom
filters.

Make the calculations before and pass the result to the method.

Change-Id: If6e3c0e644f7f940f268ca7266f577f012278ff3
2023-09-20 13:55:11 -07:00
Ronald Bhuleskar e0bd4882fb Documentation: Move writeChangedPaths flag from commitGraph to gc section.
The flag commitGraph.writeChangedPaths is not correct. The option was introduced in commit 3b77e33 (Jul 19th) under gc section so updating the documentation to reflect it under correct section.

Change-Id: Ie8f82931594ed3fd1ee3e4532d2e7475878a33a1
2023-09-19 13:33:37 -07:00
Matthias Sohn 916200e278 [errorprone] Fix wrong comparison which always evaluated to false
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java:59:
error: [ComparisonOutOfRange] ints may have a value in the range
-2147483648 to 2147483647; therefore, this comparison to
Integer.MAX_VALUE will always evaluate to false
			if (table[k] > Integer.MAX_VALUE) {
			             ^

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

We need to check if variable `uint` of type `long` exceeds the maximum
possible int value before casting it to `int` below.

This was introduced in Ib5c0d6678cb242870a0f5841bd413ad3885e95f6

Change-Id: I675d594f523084be4c1678328cc343065e32d998
2023-09-15 12:12:25 +02:00
Matthias Sohn cf5ec856bd [errorprone] Remove unnecessary comparison
Raised by errorprone:

org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitConfig.java:406: error:
[ComparisonOutOfRange] chars may have a value in the range 0 to 65535;
therefore, this comparison to 0 will always evaluate to true
					if (ch >= 0 && ch < inUse.length) {
					       ^
see https://errorprone.info/bugpattern/ComparisonOutOfRange

Change-Id: I9625aa7894a34dbffd77d39a40c6e285c86b56d5
2023-09-15 11:55:04 +02:00
Matthias Sohn 290902d9f3 Update org.eclipse.jdt:ecj to 3.35.0
Change-Id: Ic1d7fe65a0255bc0cdaf7a7285dd3532277ec07b
2023-09-15 02:07:36 +02:00
Matthias Sohn 12e9c3f1f6 Update org.apache.commons:commons-compress to 1.24.0
Change-Id: I896298f9e94b50dda6c6396e652f4a191a722a68
2023-09-15 00:55:17 +02:00
Matthias Sohn 0acc5aeafa [errorprone] Suppress ImmutableEnumChecker for ShutdownHook
Here we use enum to implement a singleton. Hence suppress the errorprone
error ImmutableEnumChecker.

Change-Id: I21f6ed83c08936dfc9aa591af809e69f3053a050
2023-09-15 00:50:19 +02:00
Matthias Sohn 8d62e5d04d Update bytebuddy to 1.14.8
Change-Id: I60ad9ea9300099eeabbb5023d7a5264593e60dc0
2023-09-15 00:48:47 +02:00
Matthias Sohn 642f160236 Use ShutdownHook to gracefully handle JVM shutdown
in all classes which already registered their own shutdown hook
- CloneCommand
- GC#PidLock
- FS#FileStoreAttributes
- LocalDiskRepositoryTestCase#Cleanup

Change-Id: I3efc1f83f3cbbf43eeeaaedcd2bee1ef31971a72
2023-09-12 22:43:15 +02:00
Matthias Sohn d4d6c2b5af Add ShutdownHook to cleanup FileLocks on graceful JVM shutdown
This should avoid stale lock files if the JVM is terminated gracefully.

Implement a ShutdownHook which can register/unregister listeners which
need to do some cleanup during graceful JVM shutdown. This hook is
registered as a Java shutdown hook and  when the JVM shuts down
calls #onShutdown of registered listeners using a parallel stream
to let them run concurrently.

See https://docs.oracle.com/javase/8/docs/technotes/guides/lang/hook-design.html

Bug: 582379
Change-Id: I1621dc5f7d9a8c832b6d1b74cbc47578b1c2f0b8
2023-09-12 22:43:15 +02:00
Matthias Sohn f94be665f1 Unregister ShutdownHook when GC#PidLock is closed
Otherwise the JVM will accumulate the ShutdownHook objects of all GCs
run while the JVM is up.

Change-Id: Iadc723a939238a3a75b4ba47f898918eb4554ea3
2023-09-12 22:43:15 +02:00
Matthias Sohn e908e297db Merge "OSGi: move plugin localization to subdirectory" 2023-09-12 16:39:19 -04:00
Thomas Wolf e3798df6e8 OSGi: move plugin localization to subdirectory
OSGi can have its plugin localization at an arbitrary place; there is
no need to have it in a top-level plugin.properties file. In non-OSGi
environments having the files at the root level may mean that these
files clash with each other, or, as in the referenced bug, with some
third-party plug-in's plugin.properties, which may not even have
anything to do with localization.

Move our OSGi localization to a subfolder OSGI-INF/l10n. For OSGi
environments, that's just as good, and for non-OSGi environments it
avoid clashes with other root level items on the classpath or in a fat
JAR.

For fragments, use neither plugin.properties (which would clash with the
host plug-in's plugin.properties) nor fragment.properties (which might
clash with other fragments for the same fragment host bundle). Instead
use names "relative" to the host bundle.

Bug: 582394
Change-Id: Ifbcd046d912e2cfe86c0f7259c5ca8de599d9aa1
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-09-12 20:27:59 +02:00
Jonathan Nieder 3bc1da30df ssh: Remove redundant null check for home.getAbsoluteFile()
File#getAbsoluteFile is non-nullable, so this check can never trigger.
Worse, getAbsoluteFile can throw an exception such as
InvalidPathException, and since this call isn't in the "try" block
that checks for that, the exception would then escape the getSession
call.

Noticed because the exception is being thrown in googlesource.com's
custom SshdSessionFactory, causing incoming ssh requests to fail
(noticed using internal tests).

Change-Id: I57f2d5e497ff678b17573f79827b6e1d9a6c9b9f
Signed-off-by: Jonathan Nieder <jrn@google.com>
2023-09-11 17:12:17 -07:00
Thomas Wolf 82c6638c72 RevertCommand: support for inserting a Gerrit change ID
Add a setter for the flag to be passed through to the CommitCommand.

Bug: 342790
Change-Id: I87548d7c2742af8af5ef6105115e3ab9c58d1d9f
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-09-08 22:58:02 +02:00
Thomas Wolf 7e502953c1 [releng] Bump japicmp base version to 6.7.0.202309050840-r
Change-Id: I8ccf8472a8bf06669ebdcd3d59d24f7d5567d89e
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-09-08 21:37:15 +02:00
Ivan Frade 7baa5a157b DfsPackFile: Record index loads only in one place
Each index can be set in the reader from two locations: the dfs cache
callback or the code afterwards. The pack is emitting the load event
in both cases, when the reference is set. This is brittle (right now
it is missing events for BITMAP_INDEX and COMMIT_GRAPH).

Emit the index loaded event only once, after going through the cache
code. The fact that the reference was set in the callback or the main
code is irrelevant. Also, the reader is per-thread, so there shouldn't
be any concurrency involved triggering double counts.

Change-Id: I7f3d078a53741ecc1e81b96353ed8faa8fef3a49
2023-09-08 11:03:38 -07:00
Ivan Frade 30427485dd DfsPackfile: Emit the index load with the index object
The DfsReader#emitIndexLoad expects a reference to the loaded object,
not to its identity hash. This makes listeneres recalculate an
identity hash over an Int object.

Pass the expected reference to the method.

Change-Id: Iee982fdd0169c93c5c7cd9cfe4260a7a82d23f6a
2023-09-08 08:29:04 -07:00
Matthias Sohn 3a3b72cf90 Prepare 6.8.0-SNAPSHOT builds
Change-Id: Ifc81f0a96c2ced0b25926b9daa539d9cfc951925
2023-09-07 02:24:53 +02:00
Matthias Sohn 6416de9563 Merge branch 'stable-6.7'
* stable-6.7:
  Prepare 6.7.1-SNAPSHOT builds
  Switch back to wagon-ssh-external
  Fix generation of maven site
  JGit v6.7.0.202309050840-r
  Remove unused API problem filters
  [releng] Bump japicmp base version to 6.6.0.202305301015-r
  Fix list of 3rd party bundles in p2 repo
  Add missing source bundle org.osgi.service.cm.source to target platform
  Prepare 6.6.2-SNAPSHOT builds
  JGit v6.6.1.202309021850-r
  Checkout: better directory handling
  Document commit-graph options supported by JGit
  Fix warning raised for local variable hiding DfsPackFile#index
  Suppress boxing warnings in DfsPackFile
  Remove unused API problem filters
  Suppress boxing warnings in tests
  Fix warning about empty block
  Update mockito to 5.5.0
  Update byte-buddy to 1.14.7
  Prepare 6.7.0-SNAPSHOT builds
  JGit v6.7.0.202308301100-rc1

Change-Id: Ib2a1000ead5ca6cf3816e9e9496ad5d92f4dc963
2023-09-07 02:24:08 +02:00
Matthias Sohn bb12dd4cbd Prepare 6.7.1-SNAPSHOT builds
Change-Id: I96097ef8c6f198220f513bbc6d5f8881834a1491
2023-09-07 02:03:54 +02:00
Matthias Sohn 09f6383f55 Switch back to wagon-ssh-external
Bug: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/2818
Change-Id: Ic283e5229b1a8a0b1ae349555ac7cfb7b046d7be
2023-09-07 01:07:04 +02:00
Matthias Sohn b438804847 Fix generation of maven site
- update maven-site-plugin to 4.0.0-M9
- use wagon-ssh extension for deployment
- disable doclint
- don't fail the build for javadoc warnings

Change-Id: I81f7229deaf6892416ce4cebd6c122f00a857d51
2023-09-07 00:06:52 +02:00
Ivan Frade 9607ee02a1 Merge "CommitGraphWriter: Make the list of chunks immutable" 2023-09-06 17:19:21 -04:00
Minh Thai ba1653162c Ensure home directory not null before using in Sshdsessionfactory
Home directory might not be set in DFS.

Change-Id: I3528685838065dc291826fc73a37126af7bf47ce
2023-09-06 07:13:05 -07:00
Ivan Frade 4f5afe9d7c CommitGraphWriter: Make the list of chunks immutable
The chunk list is calculated before start writing and it is
immutable afterwards.

Make this explicit using an unmodifiable list for the chunks.

Change-Id: I4a5cfb1f3d06a9393d8d93a3fac3c128cf3faec0
2023-09-05 11:25:54 -07:00
Ivan Frade f90f0717a0 CommitGraphWriter: Assert written bytes
The final size of the commit-graph is known before-hand. As a
safety-net, assert the written size matches the expected value.

Change-Id: Ib0828a7cce5bacb33f6325ee3910f4eebd95eb8c
2023-09-05 10:30:23 -07:00
Matthias Sohn ea02caf1e7 JGit v6.7.0.202309050840-r
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: Ibe952d97bc178adb909cdd40f48957f5b68af699
2023-09-05 14:41:09 +02:00
Matthias Sohn c024cb23d8 Remove unused API problem filters
Change-Id: If37ac92711cef94a835cfd303997a3d129d212ac
2023-09-05 14:10:30 +02:00
Thomas Wolf a5ffa44d50 [releng] Bump japicmp base version to 6.6.0.202305301015-r
Change-Id: I5392537713d4909d4fc2fee6e2b21502e0674b43
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-09-04 17:12:25 -04:00
Matthias Sohn 43681ee744 Fix list of 3rd party bundles in p2 repo
The jgit p2 repo should contain all 3rd party dependencies needed at
runtime but not dependencies only used in tests.

- remove assertj-core since it's only used in tests
- add org.eclipse.osgi and org.osgi.service.cm which are runtime
  dependencies

Change-Id: Ie789cb8feab0905e7e23aae1d5378e82a0088992
2023-09-04 16:59:52 +02:00
Matthias Sohn ee0b20c641 Add missing source bundle org.osgi.service.cm.source to target platform
Change-Id: I6e61278467ad11d28c08ee6b49e04dac0593f3e6
2023-09-04 16:57:24 +02:00
Matthias Sohn 7a6e852745 Merge branch 'stable-6.6' into stable-6.7
* stable-6.6:
  Prepare 6.6.2-SNAPSHOT builds
  JGit v6.6.1.202309021850-r
  Checkout: better directory handling

Change-Id: Ice82d68b2d343a5fac214807cdb369e486481aab
2023-09-03 02:16:04 +02:00
Matthias Sohn 43d6bc5ef1 Prepare 6.6.2-SNAPSHOT builds
Change-Id: Id4e2fbefc49115c7e3de26a34cfbe01ba6de25b2
2023-09-03 01:57:43 +02:00
Matthias Sohn ff08cbfe07 JGit v6.6.1.202309021850-r
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: I4f173dc9d634e0c9f31305961400b6b35a0a332f
2023-09-03 00:50:37 +02:00
Thomas Wolf 9072103f3b Checkout: better directory handling
When checking out a file into the working tree ensure that all parent
directories of the file below the working tree root are actually
directories and do exist before we try to create the file.

When multiple files are to be checked out (or even a whole tree), this
may check the same directories over and over again. Asking the file
system every time for file attributes is a potentially expensive
operation. As a remedy, introduce an in-memory cache of directory
states for a particular check-out operation.

Apply the same fix also in the ResolveMerger, which may also check out
files, and also in the PatchApplier. In PatchApplier, also validate
paths.

Change-Id: Ie12864c54c9f901a2ccee7caddec73027f353111
Signed-off-by: Thomas Wolf <twolf@apache.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2023-09-03 00:16:26 +02:00
Matthias Sohn 96934c9a80 Merge branch 'master' into stable-6.7
* master:
  CommitGraphWriter: throw exception on unknown chunk

Change-Id: Iaa0c563917c4195fccd57f5e6839a37008c9b808
2023-09-02 09:40:19 +02:00