Commit Graph

9539 Commits

Author SHA1 Message Date
Matthias Sohn f6f56fc9b6 JGit v6.6.0.202305031100-m2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: I30077529655918f44479f4abca36aab4d677ea33
2023-05-03 17:59:22 +02:00
Matthias Sohn 74fa245b3c Merge "Fix inProcessPackedRefsLock not shared with copies of the instance" 2023-05-03 11:10:14 -04:00
Matthias Sohn 99535cd877 Update Maven plugins
- com.github.siom79.japicmp:japicmp-maven-plugin to 0.17.2
- com.github.spotbugs:spotbugs-maven-plugin to 4.7.3.4
- maven-clean-plugin to 3.2.0
- maven-compiler-plugin to 3.11.0
- maven-deploy-plugin to 3.1.1
- maven-enforcer-plugin to 3.3.0
- maven-javadoc-plugin to 3.5.0
- maven-project-info-reports-plugin to 3.4.3
- maven-resources-plugin to 3.3.1
- maven-surefire-plugin to 3.0.0
- maven-surefire-report-plugin to 3.0.0
- org.codehaus.mojo:build-helper-maven-plugin to 3.3.0
- org.jacoco:jacoco-maven-plugin to 0.8.10
- org.springframework.boot:spring-boot-maven-plugin to 2.7.11

Change-Id: I42f3a09362a3b1afef65981cd3a862780f592af2
2023-05-03 13:53:14 +02:00
Matthias Sohn 3d90c4a433 Add TransportHttp#getAdditionalHeaders
to enable inspecting which additional HTTP headers have been set on the
transport.

Change-Id: I0771be9cb7c837de7c203b7f044109b9b2a7d7ad
2023-05-03 02:40:41 +02:00
Matthias Sohn 731dfd4c5e Add 4.27 (2023-03) and 4.28 (2023-06) target platforms
Change-Id: I81cfba607e000a107348006785ff374db960ea6d
2023-05-03 01:30:05 +02:00
Nasser Grainawi 06cfebd066 Fix inProcessPackedRefsLock not shared with copies of the instance
The in process lock is intended to manage contention on locking the
packed-refs file within a single process without acquiring the file
system lock. Not sharing it across RefDirectory instances of the same
repository undermines that intent and results in more contention at the
file system level.

Change-Id: I68f11856aa0b4b1524f43554d7391a322a0a6897
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
2023-05-02 17:14:52 -06:00
Matthias Sohn 84461e8086 Update slf4j to 1.7.36 and consume it directly from Maven Central
BundleSymbolicNames changed to the names used upstream:
- slf4j.api
- slf4j.simple

Change-Id: Ibcaafae282d3a6fa013bc39d879def1b66073bca
2023-05-02 17:05:18 +02:00
Matthias Sohn 18cb13c4ef Update assertj-core to 3.24.2
and consume it directly from Maven Central.

Add the bundle to the jgit p2 repository.

Change-Id: I95f07a6d3ea645c4f56350d4b0facbaa84988440
2023-05-01 18:13:49 +02:00
Matthias Sohn 140a8b365a Update plexus-compiler to 2.13.0
Change-Id: I2e0665a5b5b41f501ab617220678d3a93fa43718
2023-05-01 17:08:41 +02:00
Matthias Sohn f3cb30f835 Update Apache commons-codec to 1.15
and consume it directly from Maven Central.

Its BundleSymbolicName changes to "org.apache.commons.commons-codec"
which is defined upstream.

Change-Id: Id9c366b3be0b97f4b191ba78f02001306f0e5035
2023-05-01 17:08:41 +02:00
Matthias Sohn 6890b8ffa8 Update org.apache.commons:commons-compress to 1.23.0
and consume it directly from Maven Central.

Its BundleSymbolicName changes to "org.apache.commons.commons-compress"
which is defined upstream.

Change-Id: I691f5f49491dd2c9ba577ebe0c6f7cdd462c047a
2023-05-01 17:08:41 +02:00
Matthias Sohn ee2143f744 Update javaEWAH to 1.2.3 and use it directly from Maven central
This changes its BundleSymbolicName from "javaewah" (name in Orbit) to
com.googlecode.javaewah.JavaEWAH (name in upstream artefact from Maven
Central).

Change-Id: I8dee6909d496e3d05b2de938515dde831518be24
2023-05-01 17:08:41 +02:00
Matthias Sohn 4244aec376 Update org.eclipse.jdt:ecj to 3.33.0
Change-Id: I0f310762313d6ccafe3ea410bf9d4c03731f0866
2023-05-01 17:07:33 +02:00
Matthias Sohn 076b8e7636 Add missing @since tag to IntComparator
Change-Id: Ic190ab404ccb3af675cdd90cac231ce6e856ea68
2023-05-01 15:34:47 +02:00
Matthias Sohn 93e3147e51 Update to jakarta.servlet:jakarta.servlet-api:4.0.4
Change-Id: I892b44e7886f5c30be7b2003ca048e3e22aa75f6
2023-05-01 03:04:01 -04:00
Thomas Wolf 8c0c96e0a7 Support rebasing independent branches
With completely independent branches, there is no merge base. In this
case, the list of commits must include the root commit of the branch to
be rebased.

Bug: 581832
Change-Id: I0f5bdf179d5b07ff09f1a274d61c7a0b1c0011c6
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-04-29 13:24:58 +02:00
Thomas Wolf 8bc13fb79d Support cherry-picking a root commit
Handle the case of the commit to be picked not having any parents.

Since JGit implements cherry-pick as a 3-way-merge between the commit
to be picked and the target commit, using the parent of the picked
commit as merge base, this is super simple: just don't set a base tree.
The merger will not find any merge base and will supply an empty tree
iterator for the base.

Bug: 581832
Change-Id: I88985f1b1723db5b35ce58bf228bc48d23d6fca3
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-04-29 13:24:32 +02:00
Thomas Wolf 3ed4cdda6b AddCommand: ability to switch off renormalization
JGit's AddCommand always renormalizes tracked files. C git does so only
on git add --renormalize. Especially for git add . and the JGit
equivalent git.add().addFilepattern(".").call() this can make a big
difference if there are many files, or large files.

Add a "renormalize" option to AddCommand. To maintain compatibility with
existing uses, this option is "true" by default, and the behavior of
AddCommand is as it has always been in JGit.

If set to "false", use an IndexDiffFilter (in addition to a path filter,
if any). This skips any unchanged files (that are not racily clean) from
content checks. Note that changes in CRLF settings or in filters will be
ignored for such files if renormalize == false.

Add the "--renormalize" option to the Add command in the JGit command
line program. For the command-line program, the default is as in C git:
renormalize is off by default and enabled only if the option is given.
Note that --renormalize implies --update in the command line program, as
in C git. In AddCommand, the two settings are independent.

Additionally, avoid opening input streams unnecessarily in
WorkingTreeIterator.getEntryContentLength() and fix some bogus
indentation.

Add a simple test that adds 1000 files of 10kB in 10 directories twice
and that fails if the second invocation (without any changes) with
renormalize=false is not significantly faster.

Locally, I observe for that second invocation

* git.add().addFilepattern(".").call()                        ~660ms
* git.add().addFilepattern(".").setRenormalize(false).call()   ~16ms

Bug: 494323
Change-Id: I30f9d518563fa55d7058a48c27c425f3b60aeb4c
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-04-28 17:04:47 -04:00
Matthias Sohn 45de4fa2cb Update jetty to 10.0.15 and use it from Maven central directly
and update servlet-api to 4.0.1

Change-Id: Id17aad56fc6f10dd64ce088c4b5a0532f5f0c588
2023-04-28 21:46:19 +02:00
Matthias Sohn fbfc6df107 Update bouncycastle to 1.73
Review requests were created for
maven/mavencentral/org.bouncycastle/bcpkix-jdk18on/1.73
https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/7892
maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.73
https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/7893
maven/mavencentral/org.bouncycastle/bcutil-jdk18on/1.73
https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/7894

Change-Id: I389cdd7500d7d9292d7ea5eee142492dd1db7112
2023-04-28 21:46:19 +02:00
Matthias Sohn 6b831000c5 [errorprone] Fix MissingOverride error
see https://errorprone.info/bugpattern/MissingOverride
Change-Id: Iec8833eb52d91a4ef117160407b9151f25617cb5
2023-04-28 21:46:19 +02:00
Matthias Sohn 2277f13041 Merge "Merge branch 'stable-6.5'" 2023-04-28 15:22:52 -04:00
Ivan Frade a4891f9f49 Merge "PackReverseIndexWriter: write out version 1 reverse index file" 2023-04-28 14:16:25 -04:00
Matthias Sohn 4d9db14a5e Merge branch 'stable-6.5'
* stable-6.5:
  [bazel] Move ToolTestCase to src folder (6.2)
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest
  Fix after_open config and Snapshotting RefDir tests to work with bazel
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  Parse pull.rebase=preserve as alias for pull.rebase=merges
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I16e8553d187a8ef541f578291f47fc39c3da4ac0
2023-04-28 19:51:01 +02:00
Ivan Frade f9f3389847 Merge "IntList: add #sort using quick sort for O(n log n) runtime." 2023-04-28 13:49:51 -04:00
Anna Papitto 64615b44e6 PackReverseIndexWriter: write out version 1 reverse index file
The reverse index for a pack is used to quickly find an object's
position in the pack's forward index based on that object's pack offset.
It is currently computed from the forward index by sorting the index
entries by the corresponding pack offset. This computation uses
bucket sort with insertion sort, which has an average runtime of
O(n log n) and worst case runtime of O(n^2); and memory usage of
3*size(int)*n because it maintains 3 int arrays, even after sorting is
completed. The computation must be performed every time that the reverse
index object is created in memory.

In contrast, Cgit persists a pack reverse index file to avoid
recomputing the reverse index ordering every time that it is needed.
Instead they write a file with format
https://git-scm.com/docs/pack-format#_pack_rev_files_have_the_format
which can later be read and parsed into an in-memory reverse index each
time it is needed.

Introduce these reverse index files to JGit. PackReverseIndexWriter
writes out a reverse index file to be read later when needed. Subclass
PackReverseIndexWriterV1 writes a file with the official version 1
format.

To avoid temporarily allocating an Integer collection while sorting and
writing out the contents, using memory 4*size(Integer)*n, use an
IntList and its #sort method, which uses quicksort.

Change-Id: I6437745777a16f723e2f1cfcce4e0d94e599dcee
Signed-off-by: Anna Papitto <annapapitto@google.com>
2023-04-28 10:19:18 -07:00
Anna Papitto 7d3f893d31 IntList: add #sort using quick sort for O(n log n) runtime.
IntList is a class for working with lists of primitive ints without
boxing them into Integers. For writing the reverse index file format,
sorting ints will be needed but IntList doesn't provide a sorting
method yet.

Add the #sort method to sort an IntList by an IntComparator, using
quicksort, which has a average runtime of O(n log n) and sorts in-place
by using O(log n) stack frames for recursive calls.

Change-Id: Id69a687c8a16d46b13b28783b194a880f3f4c437
Signed-off-by: Anna Papitto <annapapitto@google.com>
2023-04-28 10:19:18 -07:00
Matthias Sohn 34a81889b8 Merge branch 'stable-6.4' into stable-6.5
* stable-6.4:
  [bazel] Move ToolTestCase to src folder (6.2)
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest
  Fix after_open config and Snapshotting RefDir tests to work with bazel
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I6d20fea3a417e4361b61e81756253343668eb5de
2023-04-27 02:30:20 +02:00
Matthias Sohn f87c456e8a Merge branch 'stable-6.3' into stable-6.4
* stable-6.3:
  [bazel] Move ToolTestCase to src folder (6.2)
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest
  Fix after_open config and Snapshotting RefDir tests to work with bazel
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I463f8528e623316add204848d551c44d44d04858
2023-04-27 02:20:10 +02:00
Matthias Sohn cdf35e8ead Merge branch 'stable-6.2' into stable-6.3
* stable-6.2:
  [bazel] Move ToolTestCase to src folder (6.2)
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest
  Fix after_open config and Snapshotting RefDir tests to work with bazel
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I736c7d0ed9c6e9718fa98976c3dc5a25ab8cda85
2023-04-27 02:08:05 +02:00
Matthias Sohn 9932f9b415 [bazel] Move ToolTestCase to src folder (6.2)
Bazel barks at the abstract ToolTestCase not containing any test. Move
it from the tst/ source folder to the src/ source folder so that bazel
knows this is a helper class which doesn't contain tests.

Change-Id: Ie353c27526644ea9b47437b9bd9cd730a432ab29
2023-04-27 01:53:24 +02:00
Matthias Sohn 206f0f44f6 Merge branch 'stable-6.1' into stable-6.2
* stable-6.1:
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest
  Fix after_open config and Snapshotting RefDir tests to work with bazel
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I9863cbce95d845efc891724898954b0b2f8dbf7b
2023-04-27 01:48:07 +02:00
Matthias Sohn 4451f466e0 Merge branch 'stable-6.0' into stable-6.1
* stable-6.0:
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest

Change-Id: I9c622de39200c6ee248d600736dc5db477f6bf9f
2023-04-27 01:37:29 +02:00
Matthias Sohn 74a13c7712 Merge branch 'stable-5.13' into stable-6.0
* stable-5.13:
  GcConcurrentTest: @Ignore flaky testInterruptGc
  Fix CommitTemplateConfigTest

Adapt GcConcurrentTest to changed FileRepositoryBuilder API.

Change-Id: I8906662a6391ceed20ab29cfbe238daf13e1be63
2023-04-27 01:35:59 +02:00
Jonathan Tan 2fd050c567 GcConcurrentTest: @Ignore flaky testInterruptGc
During my development of Id7721cc5b7ea650e77c2db47042715487983cae6, I
have found this test to be flaky when run by CI. As a speculative fix,
mark this test as @Ignore so it won't be run.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Change-Id: Idfe04d7f1fb72a772d4c8d249ca86a9c2eec0b1a
2023-04-27 01:00:58 +02:00
Matthias Sohn 2aaa561136 Fix CommitTemplateConfigTest
The cherry-picked 61d4e313 doesn't match 5.13 APIs which changed in
newer versions.

Change-Id: I61ed0242472ed822028d86d3038f956f6bd5735c
2023-04-27 01:00:58 +02:00
Prudhvi Akhil Alahari 70bc5aad30 Fix after_open config and Snapshotting RefDir tests to work with bazel
The changes I1db6fcf414b and I634b92877f added tests which were failing
with errors [1] and [2] with "bazel test //...". This was not caught
because we don't have CI running with bazel. Fix bazel build file so
that these errors are no longer thrown when run with bazel.

[1] error: cannot find symbol FileRepositoryBuilderTest
[2] error: cannot find symbol RefDirectoryTest

Bug: 581816
Signed-off-by: Prudhvi Akhil Alahari <quic_prudhvi@quicinc.com>
Change-Id: I1e57111662825f5f14f373bc4f8d24cce1fec0b8
2023-04-26 22:01:05 +02:00
Matthias Sohn 6082ae25dd Merge branch 'stable-6.0' into stable-6.1
* stable-6.0:
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings
  UploadPack: Fix NPE when traversing a tag chain

Change-Id: I5e13d5b5414aef97e518898166bfa166c692e60f
2023-04-26 21:55:16 +02:00
Matthias Sohn 9445e42b7a Merge branch 'stable-5.13' into stable-6.0
* stable-5.13:
  [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
  Demote severity of some error prone bug patterns to warnings

Change-Id: I63b9adc22e1e1d9a9c754fe070ddfe21a52446c7
2023-04-26 21:40:22 +02:00
Matthias Sohn 61d4e31349 [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
Move this test to another class and skip it when running tests with
bazel since the bazel test runner does not allow to create files in the
home directory.

FS#userHome retrieves the home directory on the first call and caches it
for subsequent calls to avoid overhead in case path translation is
required (currently on cygwin). This prevents that the test can mock the
home directory using MockSystemReader like SshTestHarness does.

Change-Id: I6a22f37f4a19eb4b4935509eae508a23e56db7aa
2023-04-26 21:26:05 +02:00
David Ostrovsky f3a3a2e877 Demote severity of some error prone bug patterns to warnings
The code is not violation free, so demote the severity of these bug
patterns to warning:

o DefaultCharset
o FutureReturnValueIgnored
o UnusedException

Change-Id: Ie886a4a247770a74953385f018498ac2515ed209
2023-04-26 21:07:41 +02:00
Matthias Sohn 46732d6af9 [bazel] Fix version number of bcpg-jdk18on
Add the missing quotes around the version number.

Change-Id: Ia24484f50a4e771e046aa65621ae4779fff64d86
2023-04-24 13:28:32 +02:00
Matthias Sohn 032eef5b12 Parse pull.rebase=preserve as alias for pull.rebase=merges
This ensures backwards compatibility to the old config value which was
removed in git 2.34 which JGit followed in Ic07ff954e2.

Change-Id: I2b4e27fd71898b6e0e227e406c40682bd9786cd4
2023-04-22 23:43:40 +02:00
Matthias Sohn bf201be0be Use bouncycastle libraries directly from Maven Central
and update
- org.bouncycastle:bcpg-jdk18on to 1.72.2

Bug: 581767
Change-Id: Id213e84d56c171c98b1919a7044e2779a3d777df
2023-04-21 23:37:35 +02:00
Kaushik Lingarkar 064691e90c UploadPack: Fix NPE when traversing a tag chain
Always parse RevTags including their body before getting their object
to ensure that non-cached objects are handled correctly when traversing
a tag chain. An NPE in UploadPack#addTagChain will occur on a depth=1
fetch of a branch containing a tag chain and the ref to one of the
middle tags in the chain is deleted.

Change-Id: Ifd8fe868869070b365df926fec5dcd8e64d4f521
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
2023-04-21 02:04:35 +02:00
Matthias Sohn 4117bf9d74 Add missing @since tag for BatchRefUpdate#getRefDatabase
Change-Id: I5d37cbbd6c338e6e6bb8b95ae13a5ed9b5178a8b
2023-04-21 00:59:07 +02:00
Matthias Sohn f0829b0c46 Merge branch 'stable-6.5'
* stable-6.5:
  Add missing since tag for SshBasicTestBase
  Add missing since tag for SshTestHarness#publicKey2
  Silence API errors
  Prevent infinite loop rescanning the pack list on PackMismatchException
  Remove blank in maven.config

Change-Id: I0b03ca566053a158c6c8e75ccec8360a2f368ed9
2023-04-21 00:52:18 +02:00
Matthias Sohn 06b40b95c2 Merge branch 'stable-6.4' into stable-6.5
* stable-6.4:
  Add missing since tag for SshBasicTestBase
  Add missing since tag for SshTestHarness#publicKey2
  Silence API errors
  Prevent infinite loop rescanning the pack list on
PackMismatchException
  Remove blank in maven.config

Change-Id: I89af76946014fb44bd64c20e2b01a53397768d90
2023-04-21 00:45:30 +02:00
Matthias Sohn 6456059795 Merge branch 'stable-6.3' into stable-6.4
* stable-6.3:
  Add missing since tag for SshBasicTestBase
  Add missing since tag for SshTestHarness#publicKey2
  Silence API errors
  Prevent infinite loop rescanning the pack list on PackMismatchException
  Remove blank in maven.config

Change-Id: I18b46be0f09535c61efabe24ab1579faa3d06ba8
2023-04-21 00:33:26 +02:00
Matthias Sohn 76aa6f2840 Merge branch 'stable-6.2' into stable-6.3
* stable-6.2:
  Add missing since tag for SshBasicTestBase
  Add missing since tag for SshTestHarness#publicKey2
  Silence API errors
  Prevent infinite loop rescanning the pack list on PackMismatchException
  Remove blank in maven.config

Change-Id: I8006068f16ae442a2246e043a680053f2af34e9f
2023-04-21 00:25:51 +02:00