]> source.dussan.org Git - jgit.git/log
jgit.git
10 months agoFooterLine: First line cannot be a footer 30/1172930/1
Ivan Frade [Wed, 29 Nov 2023 18:51:04 +0000 (10:51 -0800)]
FooterLine: First line cannot be a footer

The first line of the commit message cannot be a footer line. This
restriction was dropped in commit [1] while adding multiline
footers. This affects at least the git-numberer gerrit plugin, that
even have a test for it [2].

Reintroduce the restriction that the first line of the commit message
cannot be a footer and bring the test from git-numberer to jgit.

[1] https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1172664
[2] https://chromium.googlesource.com/infra/gerrit-plugins/git-numberer/+/refs/heads/main/src/test/java/com/googlesource/chromium/plugins/gitnumberer/GetFooterLinesTest.java

Change-Id: Id3fa6b8614664dbc3fdccffe1006b0b9752a8de6

10 months agoReapply "Improve footer parsing to allow multiline footers." 29/1172929/1
Ivan Frade [Wed, 29 Nov 2023 21:44:02 +0000 (13:44 -0800)]
Reapply "Improve footer parsing to allow multiline footers."

This reverts commit e99fb6edc4b4eba43e27f9945df043e72ab297dd.

10 months agoRevert "Improve footer parsing to allow multiline footers." 02/1172902/1
Ivan Frade [Wed, 29 Nov 2023 18:05:07 +0000 (10:05 -0800)]
Revert "Improve footer parsing to allow multiline footers."

This reverts commit 340cc787a0d14a0698d757a919ccd77e0a129fb0.

This breaks a test in the git_numberer gerrit plugin used by chromium
[1].  The test checks that first line is never a footer, which sounds
right. That test should be included in FooterLineTest.

[1]
https://chromium.googlesource.com/infra/gerrit-plugins/git-numberer/+/refs/heads/main/src/test/java/com/googlesource/chromium/plugins/gitnumberer/GetFooterLinesTest.java

10 months agoMerge "Improve footer parsing to allow multiline footers."
Matthias Sohn [Sun, 26 Nov 2023 18:35:54 +0000 (18:35 +0000)]
Merge "Improve footer parsing to allow multiline footers."

10 months agoMerge "Make the tests buildable by bazel test"
Matthias Sohn [Sat, 25 Nov 2023 19:54:02 +0000 (19:54 +0000)]
Merge "Make the tests buildable by bazel test"

10 months agoAdapt to type parameter added in commons-compress 1.25.0 21/205521/3
Matthias Sohn [Fri, 17 Nov 2023 23:06:01 +0000 (00:06 +0100)]
Adapt to type parameter added in commons-compress 1.25.0

In 1.25.0 commons-compress added a generic type parameter to
ArchiveOutputStream to avoid unchecked/unconfirmed type casts in
subclasses.

Change-Id: Ib4c208fc1fb65f73ea57c5bf723fde71b0d6d9f7

10 months agoImprove footer parsing to allow multiline footers. 64/1172664/2
Kamil Musin [Fri, 24 Nov 2023 14:17:26 +0000 (15:17 +0100)]
Improve footer parsing to allow multiline footers.

According to the https://git-scm.com/docs/git-interpret-trailers the
CGit supports multiline trailers. Subsequent lines of such multiline
trailers have to start with a whitespace.

We also rewrite the original parsing code to make it easier to work
with. The old code had pointers moving both backwards and forwards at
the same time. In the rewritten code we first find the start of the last
paragraph and then do all the parsing.

Since all the getters of the FooterLine return String, I've considered
rewriting the parsing code to operate on strings. However the original
code seems to be written with the idea, that the data is only lazily
copied in getters and no extra allocations should be performed during
original parsing (ex. during RevWalk). The changed code keeps to this
idea.

Bug: Google b/312440626
Change-Id: Ie1e3b17a4a5ab767b771c95f00c283ea6c300220

10 months agoMake the tests buildable by bazel test 62/1172662/5
Kamil Musin [Thu, 23 Nov 2023 10:47:53 +0000 (11:47 +0100)]
Make the tests buildable by bazel test

All the errorprone checkers fail in many existing places of the
codebase, making it impossible to run bazel test. Downgrade all to
":WARN".

MergeToolTest is asserting a wrong error line, but the line seems
different between bazel and mvn test runs. Therefore we don't fix it and
simply run

```
bazel test -- //... -//org.eclipse.jgit.pgm.test:pgm
```

Change-Id: I44913ebc70dcc934cb69481cc3ff9ae0d8059707

10 months agoBitmapIndex: Add interface to track bitmaps found (or not) 13/1172413/2
Ivan Frade [Mon, 20 Nov 2023 20:01:12 +0000 (12:01 -0800)]
BitmapIndex: Add interface to track bitmaps found (or not)

We want to know what objects had bitmaps in the walk of the
request. We can check their position in the history and evaluate our
bitmap selection algorithm.

Introduce a listener interface to the BitmapIndex to report which
getBitmap() calls returned a bitmap (or not) and a method to the
bitmap index to set the listener.

Change-Id: Iac8fcc1539ddd2dd450e8a1cf5a5b1089679c378

10 months agoBitmapWalker: Remove BitmapWalkListener 12/1172412/2
Ivan Frade [Mon, 20 Nov 2023 18:25:03 +0000 (10:25 -0800)]
BitmapWalker: Remove BitmapWalkListener

We can track bitmaps queries that found a bitmap directly in the
BitmapIndex.

Remove the listener.

Change-Id: I5ad518a58b681bf327fee3ae5c5f6e4449d3da1f

10 months agoUpdate repository URLs in CONTRIBUTING.md 86/1172386/1
Matthias Sohn [Mon, 20 Nov 2023 21:03:32 +0000 (22:03 +0100)]
Update repository URLs in CONTRIBUTING.md

after the move to eclipse.gerrithub.io.

Change-Id: I8e7aac62c991b941def263d3d7585991f1355738

10 months agoMerge "Fix typo in FileUtils.isStaleFileHandle() javadoc"
Matthias Sohn [Fri, 17 Nov 2023 23:45:17 +0000 (18:45 -0500)]
Merge "Fix typo in FileUtils.isStaleFileHandle() javadoc"

10 months agoFix typo in FileUtils.isStaleFileHandle() javadoc 32/205532/2
Dariusz Luksza [Thu, 16 Nov 2023 15:52:38 +0000 (15:52 +0000)]
Fix typo in FileUtils.isStaleFileHandle() javadoc

Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
Change-Id: Iac431bbcb00f0a1fa36e2ba4af5fe33fcee69e04

10 months agoFix branch ref exist check 74/204974/3
florian.signoret [Mon, 16 Oct 2023 14:08:14 +0000 (16:08 +0200)]
Fix branch ref exist check

When a tag with the same name as the branch exists, the branch creation
process should work too. We should detect that the branch already
exists, and allow to force create it when the force option is used.

Bug: 582538
Change-Id: I3b350d03be8edcde10e97b2318343240ca896cb0

10 months agogpg.bc: Supress errorprone InsecureCryptoUsage 45/205545/1
Ivan Frade [Fri, 17 Nov 2023 18:14:26 +0000 (10:14 -0800)]
gpg.bc: Supress errorprone InsecureCryptoUsage

From errorprone doc: "Dynamically constructed transformation strings
are also flagged, as they may conceal an instance of ECB mode."

https://errorprone.info/bugpattern/InsecureCryptoUsage

Silence the message as a quick relief.

Change-Id: I348f0fff0e3b24ce1f11917e849b4095b186d1f0

10 months agoAdjust javadoc to pass errorprone checks 44/205544/1
Ivan Frade [Fri, 17 Nov 2023 18:11:17 +0000 (10:11 -0800)]
Adjust javadoc to pass errorprone checks

bazel build //org.eclipse.jgit.test:all doesn't build due to
errorprone errors. This leds to disabling the checks and find the
errors later in the jenkins builder.

Fix javadoc errors reported by errorprone. This doesn't fix completely
the build but it is a step towards it.

Change-Id: Ic4ec93a2d71d4628bf3a05277c60157881156393

10 months agoMerge "Update org.apache.commons:commons-compress to 1.25.0"
Matthias Sohn [Fri, 17 Nov 2023 07:34:54 +0000 (02:34 -0500)]
Merge "Update org.apache.commons:commons-compress to 1.25.0"

10 months agoMerge "Fix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD"
Matthias Sohn [Fri, 17 Nov 2023 00:41:46 +0000 (19:41 -0500)]
Merge "Fix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD"

10 months agoMerge "BitmapWalkListener: Use plain interface with noop instance"
Ivan Frade [Fri, 17 Nov 2023 00:22:16 +0000 (19:22 -0500)]
Merge "BitmapWalkListener: Use plain interface with noop instance"

10 months agoUpdate org.apache.commons:commons-compress to 1.25.0 16/205516/1
Matthias Sohn [Fri, 17 Nov 2023 00:05:25 +0000 (01:05 +0100)]
Update org.apache.commons:commons-compress to 1.25.0

Change-Id: Ic9c6910853ad00075501aa3e03888fefbe634bf6

10 months agoFix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD 10/205510/2
Matthias Sohn [Wed, 15 Nov 2023 23:24:29 +0000 (00:24 +0100)]
Fix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD

Change-Id: I71f067199c63aa1407f543f6d40ef05b928e9f95

10 months agoMerge "Update bouncycastle to 1.77"
Matthias Sohn [Fri, 17 Nov 2023 00:06:15 +0000 (19:06 -0500)]
Merge "Update bouncycastle to 1.77"

10 months agoBitmapWalkListener: Use plain interface with noop instance 39/205539/4
Ivan Frade [Thu, 16 Nov 2023 23:12:47 +0000 (15:12 -0800)]
BitmapWalkListener: Use plain interface with noop instance

In this new interface default methods are useful only to instantiate
noop instances. We rather reuse the same noop instance and save the
"default" to add backward compatible methods to existing interfaces.

Make the methods regular interface methods and provide a noop
instance.

Change-Id: Ie84ff17c8e9f16837245751739ee8c99463e76ee

10 months agoBitmapWalkListener: Add method and rename for commits 35/205535/2
Ivan Frade [Thu, 16 Nov 2023 18:46:07 +0000 (10:46 -0800)]
BitmapWalkListener: Add method and rename for commits

During the walk, the commit can be either
1. already in the walk bitmap
2. unvisited so far with bitmap in the bitmap index
3. unvisited so far without bitmap in the bitmap index

Expose these three states in the interface. This makes the interface
easier to explain: it reports the commits found during the walk.

As it is all about commits, rename the methods to onCommit***.

Change-Id: I661f303eb22d3e735b0e439f16df7ace612376d9

11 months agoMerge "CommitGraphWriter: Remove unnecesary progress update call"
Ivan Frade [Thu, 16 Nov 2023 19:53:13 +0000 (14:53 -0500)]
Merge "CommitGraphWriter: Remove unnecesary progress update call"

11 months agoUpdate bouncycastle to 1.77 85/205485/2
Matthias Sohn [Wed, 15 Nov 2023 20:32:20 +0000 (21:32 +0100)]
Update bouncycastle to 1.77

Change-Id: I2dc011247ace2eeea8c46587cae55a39be086f36

11 months agoMerge "PatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream"
Jonathan Nieder [Thu, 16 Nov 2023 10:26:55 +0000 (05:26 -0500)]
Merge "PatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream"

11 months agoPatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream 72/205472/7
Nitzan Gur-Furman [Wed, 15 Nov 2023 20:04:00 +0000 (21:04 +0100)]
PatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream

The documentation for TemporaryBuffer::length says:
"The length is only accurate after {@link #close()} has been invoked".
However, we need to have the stream open while accessing the length.

This prevents patches on large files to be applied correctly, as the
result get trimmed.

Bug: Google b/309500446
Change-Id: Ic1540f6d0044088f3b46f1fad5f6a28ec254b711

11 months agoMerge "BitmapWalker: announce walked objects via listener interface"
Ivan Frade [Wed, 15 Nov 2023 23:33:30 +0000 (18:33 -0500)]
Merge "BitmapWalker: announce walked objects via listener interface"

11 months agoBitmapWalker: announce walked objects via listener interface 03/205503/3
Ivan Frade [Wed, 15 Nov 2023 18:25:22 +0000 (10:25 -0800)]
BitmapWalker: announce walked objects via listener interface

We want to know what objects had a bitmap in the walk, to see where do
they sit in the commit history and evaluate our bitmap selection
algorithm.

Add a listener interface to the bitmap walker announcing the objects
walked and whether they had bitmap.

Change-Id: I956fe2ad927a500710d2cbe78ecd4d26f178c266

11 months agoMerge branch 'stable-6.8' 07/205507/1
Matthias Sohn [Wed, 15 Nov 2023 22:43:53 +0000 (23:43 +0100)]
Merge branch 'stable-6.8'

* stable-6.8:
  Prepare 6.8.0-SNAPSHOT builds
  JGit v6.8.0.202311151710-m2

Change-Id: I26603b974f0ccd5a6da3801988d925d73a692c0e

11 months agoPrepare 6.8.0-SNAPSHOT builds 06/205506/1
Matthias Sohn [Wed, 15 Nov 2023 22:42:56 +0000 (23:42 +0100)]
Prepare 6.8.0-SNAPSHOT builds

Change-Id: Id11a260db84aea6743f2e6edec8b8010693aab42

11 months agoUpdate jetty to 10.0.18 80/205480/1
Matthias Sohn [Wed, 15 Nov 2023 21:20:29 +0000 (22:20 +0100)]
Update jetty to 10.0.18

Change-Id: I34c9f7c062400bb69849812d57390dd2e7b04cac

11 months agoSSH: bump org.apache.sshd to 2.11.0 88/205088/2
Thomas Wolf [Sat, 21 Oct 2023 13:15:34 +0000 (15:15 +0200)]
SSH: bump org.apache.sshd to 2.11.0

Update maven build, bazel build, and target platform.

Also remove a file in a ./bin directory that got committed by mistake
in commit f5f4bf0ad.

Change-Id: Ia653c71643f8fad290874d723dacdafbef25c13f
Signed-off-by: Thomas Wolf <twolf@apache.org>
11 months agoJGit v6.8.0.202311151710-m2 78/205478/1 v6.8.0.202311151710-m2
Matthias Sohn [Wed, 15 Nov 2023 17:11:07 +0000 (18:11 +0100)]
JGit v6.8.0.202311151710-m2

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

11 months agoMerge branch 'master' into stable-6.8 76/205476/1
Matthias Sohn [Wed, 15 Nov 2023 17:05:54 +0000 (18:05 +0100)]
Merge branch 'master' into stable-6.8

* master: (42 commits)
  Fix typo in constant name CONFIG_KEY_STREAM_FILE_TRESHOLD
  Simplify StringUtils#commonPrefix
  Optimize RefDirectory.getRefsByPrefix(String...)
  Use try-with-resource to ensure UploadPack is closed
  Fix hiding field warning
  Fix warning for empty code blocks
  Fix boxing warnings
  errorprone: remove unnecessary parentheses
  Update mockito to 5.7.0 and bytebuddy to 1.14.9
  Enable Maven reproducible builds
  Upgrade bazlets to the latest revision
  Revert "Optimise Git protocol v2 `ref-prefix` scanning"
  Document GIT_TRACE_PERFORMANCE to show timings
  config-options.md: fix sort order
  ComboBitset: Add Javadoc
  CommitGraphWriter: Add progress monitor to bloom filter computation
  CommitGraphWriter: Use ProgressMonitor from the OutputStream
  CommitGraphWriter: Unnest generation-number progress
  Optimise Git protocol v2 `ref-prefix` scanning
  UploadPackTest: Cover using wanted-refs as advertised set
  ...

Change-Id: I5398f2342eac83ebdc823befe8e7de0cf8ba6d5b

11 months agoFix typo in constant name CONFIG_KEY_STREAM_FILE_TRESHOLD 73/205473/1
Matthias Sohn [Wed, 15 Nov 2023 15:02:43 +0000 (16:02 +0100)]
Fix typo in constant name CONFIG_KEY_STREAM_FILE_TRESHOLD

Since it's part of the API deprecate the wrong spelling and add the
correct one with the same value.

Change-Id: I0f6ea95a5e66c9e80142eb6d40eb7ec3a7aaf8e2

11 months agoSimplify StringUtils#commonPrefix 66/205466/2
Nasser Grainawi [Mon, 13 Nov 2023 23:12:24 +0000 (00:12 +0100)]
Simplify StringUtils#commonPrefix

By first checking for null-ness and then for the number of strings to
compare we can get rid of a redundant null check.

Change-Id: I0d9a088352c6c1ffea12bc2cded2c63e5293a8a7

11 months agoOptimize RefDirectory.getRefsByPrefix(String...) 87/205387/4
Dariusz Luksza [Thu, 9 Nov 2023 11:18:38 +0000 (11:18 +0000)]
Optimize RefDirectory.getRefsByPrefix(String...)

Currently for file-based repositories JGit will go over all refs in the
repository forach `ref-prefix` listed in the `ls-refs` command in git
protocol v2 request.

Native git, uses a different approach, where all refs are read once and
then for each ref, all `ref-prefix` filter values are checked in one
pass.

This change implements this approach in JGit only in the `RefDirectory`
backend. And makes `ref-prefix` filtering ~40% faster for repositories
with packed refs.

Different implementations were tested on a synthetic file repository
with 10k refs in `refs/heads/` and `290k` in `refs/changes`. Before
testing `git pack-refs` command was executed. All results are in
seconds.

Current Impl:               39.340   37.093   35.996
Nested for loops:           25.077   24.742   24.748
Nested streams:             24.827   24.890   27.525
Parallel stream + stream:   23.357   23.318   23.174
Nested parallel streams:    23.490   23.318   23.317
Stream + for loop:          23.147   23.210   23.126
Parallel stream + for loop: 23.317   23.423   22.847

The elapsed time was measured around `getRefByPrefix` call in
`Uploadapack.getFilteredRefs(Collection<String>)` (around lines 952 and
954). For testing a modified version of
`UploadPackTest.testV2LsRefsRefPrefix()` was used. The modifications
here included:
  * shadowing protected `repo` variable with `FileRepository` pointing
    to the synthetic repo with 300k refs described above,
  * mimicking the git client clone request by adding `ref-prefix HEAD`,
    `ref-prefix refs/heads/` and `ref-prefix refs/tags/`

Based on the above results, the implementation with parallel stream and
stream was selected.

Bug: 578550
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
Change-Id: I6416846c074b611ff6ec9d351dbafcfbcaf68e66

11 months agoCommitGraphWriter: Remove unnecesary progress update call 02/205402/1
Ivan Frade [Thu, 9 Nov 2023 22:45:32 +0000 (14:45 -0800)]
CommitGraphWriter: Remove unnecesary progress update call

Change [1] reduced the scope of the "writing commit graph" monitoring
task. This left some monitor#update() calls out of any task. When out
of a task, the #update call is a noop.

Delete this update calls as they are noops and misleading.

The affected chunks are usually small and quick to write, so probably
they don't need progress monitoring.

[1] https://git.eclipse.org/r/c/jgit/jgit/+/205339

Change-Id: I74d94e6e44e58816937dc8a84e5a10b340e54e0b

11 months agoMerge changes I0d10aeac,I9aced1b7,Ied394859,Ibb61f63f,I20498746, ...
Matthias Sohn [Fri, 10 Nov 2023 08:03:36 +0000 (03:03 -0500)]
Merge changes I0d10aeac,I9aced1b7,Ied394859,Ibb61f63f,I20498746, ...

* changes:
  Use try-with-resource to ensure UploadPack is closed
  Fix hiding field warning
  Fix warning for empty code blocks
  Fix boxing warnings
  errorprone: remove unnecessary parentheses
  Update mockito to 5.7.0 and bytebuddy to 1.14.9
  Enable Maven reproducible builds
  Upgrade bazlets to the latest revision

11 months agoMerge "Revert "Optimise Git protocol v2 `ref-prefix` scanning""
Ivan Frade [Wed, 8 Nov 2023 23:15:51 +0000 (18:15 -0500)]
Merge "Revert "Optimise Git protocol v2 `ref-prefix` scanning""

11 months agoUse try-with-resource to ensure UploadPack is closed 60/205360/1
Matthias Sohn [Wed, 8 Nov 2023 23:06:19 +0000 (00:06 +0100)]
Use try-with-resource to ensure UploadPack is closed

Change-Id: I0d10aeac959a49b3bf2e83b0c104699d1d21f5e9

11 months agoFix hiding field warning 59/205359/1
Matthias Sohn [Wed, 8 Nov 2023 22:41:16 +0000 (23:41 +0100)]
Fix hiding field warning

Change-Id: I9aced1b711901918667555a4cfff76992024e59c

11 months agoFix warning for empty code blocks 58/205358/1
Matthias Sohn [Wed, 8 Nov 2023 22:39:35 +0000 (23:39 +0100)]
Fix warning for empty code blocks

Change-Id: Ied394859e8c76bb1a2362d31962ab862b26b279f

11 months agoFix boxing warnings 57/205357/1
Matthias Sohn [Wed, 8 Nov 2023 22:38:09 +0000 (23:38 +0100)]
Fix boxing warnings

Change-Id: Ibb61f63f17e909ee0e6a781c9418f7c1ac2c7cd7

11 months agoerrorprone: remove unnecessary parentheses 56/205356/1
Matthias Sohn [Wed, 8 Nov 2023 22:36:54 +0000 (23:36 +0100)]
errorprone: remove unnecessary parentheses

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

Change-Id: I204987469d478c9cc887ac66c9ffc84c9977c400

11 months agoUpdate mockito to 5.7.0 and bytebuddy to 1.14.9 16/205216/3
Matthias Sohn [Tue, 31 Oct 2023 00:13:50 +0000 (01:13 +0100)]
Update mockito to 5.7.0 and bytebuddy to 1.14.9

Change-Id: I7c93847054050a0af0d2c16e724e5755f9fa33bf

11 months agoEnable Maven reproducible builds 85/204785/10
Matthias Sohn [Thu, 5 Oct 2023 23:10:40 +0000 (01:10 +0200)]
Enable Maven reproducible builds

- configure Maven to run build reproducibly [1]
- use UTC timestamp of checked out commit as build timestamp
- add git-describe, git-commit-id, git-commit-id, git-tags,
  git-remote-origin-url to MANIFEST.MF files
- configure cyclonedx-maven-plugin to also use UTC timestamp of
  checked out commit
- for packaging build use tycho-buildtimestamp-jgit [2] to ensure
  version uses the timestamp of the last commit
- SBOMs are not reproducible by design [3] they should have a build
  timestamp matching the time when the build was executed and a serial
  number which is a unique UUID per build run. Hence exclude them from
  comparison [4].
- Use gmavenplus-plugin to format build timestamps. Maven expects
  build timestamp in ISO-8601 format, to replace the qualifier in
  versions the timestamp format must be compatible with rules for OSGi
  version numbers. Didn't find a way to read the properties set by the
  git-commit-id-maven-plugin from another plugin. Hence use JGit in a
  groovy script to get the commit time of the current HEAD and provide
  it in these two formats.

TODO: packaging build (features and p2 repository) is not yet binary
reproducible since that's not yet supported by Tycho [5], artefacts have
reproducible version numbers but file lastModified timestamps are not
yet reproducible.

Test plan for Maven build:
- build using
  mvn clean install"
- verify second build is reproducible:
  mvn -T1 clean verify artifact:compare
  verification seems not to be thread-safe, hence run it with a single
  thread using option -T1

For packaging build (still fails due to non-reproducible file
timestamps):
- build using
  mvn -f org.eclipse.jgit.packaging/pom.xml clean install
- verify second build is reproducible:
  mvn -T1 -f org.eclipse.jgit.packaging/pom.xml clean verify artifact:compare

[1] https://maven.apache.org/guides/mini/guide-reproducible-builds.html
[2] https://wiki.eclipse.org/Tycho/Reproducible_Version_Qualifiers
[3] https://github.com/CycloneDX/cyclonedx-maven-plugin/issues/84
[4] https://maven.apache.org/plugins/maven-artifact-plugin/compare-mojo.html
[5] https://github.com/eclipse-tycho/tycho/issues/233

Change-Id: I0202f55a1b6ae0edd922cfef638beb39d2ce9417

11 months agoUpgrade bazlets to the latest revision 83/204983/2
David Ostrovsky [Tue, 17 Oct 2023 12:24:46 +0000 (14:24 +0200)]
Upgrade bazlets to the latest revision

Includes:
junit.bzl: Suppress default package warning flagged by error prone

Change-Id: Id8e8dd7cca7264328c4121ac3da4d9d5e8e407de

11 months agoRevert "Optimise Git protocol v2 `ref-prefix` scanning" 56/205256/1
Ivan Frade [Wed, 8 Nov 2023 22:48:08 +0000 (17:48 -0500)]
Revert "Optimise Git protocol v2 `ref-prefix` scanning"

This reverts commit 3937300f3eb4dd557ec2d195f21793f737d6cb4e.

Reason for revert: This kills performance on the DFS side, that relies on loading the minimal amount of refs and reftables for quick prefix searches.

Reverting as a safe option to keep master in good performance until we decide how to reintroduce this change.

Change-Id: I7b1a3f900d9c78ce95cf0972abb50b6becfe3bb1

11 months agoMerge "ComboBitset: Add Javadoc"
Matthias Sohn [Wed, 8 Nov 2023 07:49:06 +0000 (02:49 -0500)]
Merge "ComboBitset: Add Javadoc"

11 months agoDocument GIT_TRACE_PERFORMANCE to show timings 54/205354/1
Matthias Sohn [Wed, 8 Nov 2023 01:49:23 +0000 (02:49 +0100)]
Document GIT_TRACE_PERFORMANCE to show timings

Change-Id: I5a39b072c50e64a2d940680ed85866edfe9d0d28

11 months agoconfig-options.md: fix sort order 53/205353/1
Matthias Sohn [Wed, 8 Nov 2023 01:41:28 +0000 (02:41 +0100)]
config-options.md: fix sort order

Change-Id: Idf233e7b6ca41de9460b41b3d24c84f9e85472d6

11 months agoComboBitset: Add Javadoc 43/203443/3
Han-Wen Nienhuys [Mon, 31 Jul 2023 18:02:56 +0000 (20:02 +0200)]
ComboBitset: Add Javadoc

Change-Id: I799991327cadf646329eacbac40d41cb1b3391ad

11 months agoCommitGraphWriter: Add progress monitor to bloom filter computation 44/205344/1
Ivan Frade [Tue, 7 Nov 2023 22:30:15 +0000 (14:30 -0800)]
CommitGraphWriter: Add progress monitor to bloom filter computation

Bloom filter computation can be an expensive process and right now it
is invisible to the user.

Report progress while calculating bloom filters.

Log of GC with bloom filter enabled:

Computing commit-graph path bloom filters: 100% (9551/9551)
Computing commit-graph generation numbers: 100% (9551/9551)
Writing out commit-graph: 100% (9551/9551)

Change-Id: Ife65e63ac2c37d064d5f049a366cbb52c3ef6798

11 months agoCommitGraphWriter: Use ProgressMonitor from the OutputStream 43/205343/1
Ivan Frade [Tue, 7 Nov 2023 22:00:05 +0000 (14:00 -0800)]
CommitGraphWriter: Use ProgressMonitor from the OutputStream

The same progress monitor is passed around as parameter and inside the
output stream. The functions use one to start tasks and another to
report progress, which is confusing. The stream needs the monitor to
check cancellations so we cannot remove it from there.

Make all code take the monitor from the stream.

Change-Id: Id3cb9c1cb0bd47318b46ef934a9d4037341e25a7

11 months agoCommitGraphWriter: Unnest generation-number progress 39/205339/2
Ivan Frade [Tue, 7 Nov 2023 19:36:51 +0000 (11:36 -0800)]
CommitGraphWriter: Unnest generation-number progress

The ProgressMonitor task to track the calculation of generation
numbers is nested inside the task that follows the writing of all
lines in the commit-graph. ProgressMonitor doesn't support nested
tasks and this confuses the counting.

Move the start/end of the "writing commit graph" task to the
writeCommitData section, after calculating the generation
numbers. Make that task track by commits instead of by lines.

Moving the start/end of the progress task to the chunk-writing
functions is clearer and easier to extend.

Logging of GC before:
Writing out commit-graph in 3 passes:  51% ( 9807/19358)
Computing commit-graph generation numbers: 100% (9551/9551)

Logging of GC after:
Computing commit-graph generation numbers: 100% (9551/9551)
Writing out commit-graph: 100% (9551/9551)

Change-Id: I87d69c06c9a3c7e75be12b6f0d1a63b5924e298a

11 months agoOptimise Git protocol v2 `ref-prefix` scanning 10/204910/13
Dariusz Luksza [Fri, 3 Nov 2023 11:52:03 +0000 (11:52 +0000)]
Optimise Git protocol v2 `ref-prefix` scanning

Currenty JGit will go over all refs in the repository for each
`ref-prefix`. This means that refs will be read multiple
times, which leads to subpar performance.

Native git, uses a different approach, where all refs are read once
and then for each ref, all `ref-prefix` filter values are checked in
one pass.

This change implements this approach in JGit. And makes `ref-prefix`
filtering ~28% faster for a repository with fully packed refs
and ~5% when RefTable is used instead of refdir.

Different implementations were tested on a synthetic file repository
with 300k refs. Different implementations were tested for unpacked and
fully packed refs (results are in seconds).

Unpacked refs:
 Current Impl:               54.838   57.234   56.138
 Nested for loops:           36.094   37.025   36.502
 Nested stream's:            36.154   35.989   37.262
 Parallel stream + stream:   36.923   37.272   35.362
 Nested parallel stream's:   35.512   38.395   36.745
 Stream + for loop:          34.950   36.164   37.191
 Parallel stream + for loop: 37.695   35.511   35.378

Packed refs:
 Current Impl:               39.713   39.954   38.653
 Nested for loops:           29.891   29.753   29.377
 Nested stream's:            30.340   29.637   30.412
 Parallel stream + stream:   28.653   28.254   29.138
 Nested parallel stream's:   29.942   28.850   31.030
 Stream + for loop:          29.405   29.576   30.539
 Parallel stream + for loop: 29.012   29.215   29.380

RefTable:
 Current Impl:               0.273   0.294   0.330
 Nested for loops:           0.252   0.169   0.215
 Nested stream's:            0.252   0.228   0.213
 Parallel stream + stream:   0.233   0.259   0.247
 Nested parallel stream's:   0.416   0.309   0.340
 Stream + for loop:          0.224   0.247   0.242
 Parallel stream + for loop: 0.347   0.246   0.346

The elapsed time was measured around `getRefsByPrefix` call in
`UploadPack.getFilteredRefs(Collection<String>)` (around lines 952 and
954).

Based on the above results, the implementation with parallel stream and
stream was selected.

Bug: 578550
Change-Id: Iac3a3aacf897b87b3448c1d528cdac64ad312199
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
11 months agoUploadPackTest: Cover using wanted-refs as advertised set 81/205181/2
Ivan Frade [Tue, 24 Oct 2023 16:37:13 +0000 (09:37 -0700)]
UploadPackTest: Cover using wanted-refs as advertised set

Parent change introduced using "wanted-refs" as advertised set during
fetchV2, but it tested only a request without wantIds (only
wanted-refs).

Add a second where the request has wanted-refs AND wantId (which
disables the optimization). Change the test to measure the amount of
refs considered advertised, instead of relying in calls to the
refdb.

Change-Id: Id64ec933fd737bae1bfd429c7b8cc05b51a83870

11 months agoUploadPack: use want-refs as advertised set in fetch v2 30/193330/12
Patrick Hiesel [Fri, 13 May 2022 11:49:02 +0000 (13:49 +0200)]
UploadPack: use want-refs as advertised set in fetch v2

Protocol v2 introduced refs-in-wants and ls-remote with
prefixes. UploadPack already uses prefixes provided by the client
during a v2 ref advertisement (ls-refs). However, when the client
consequently sends another request to fetch a previously advertised
ref (with want-ref lines), the server uses the whole set of advertised
refs to compute reachability.

In repos with many refs, this slows down the reachability checks
setting up and walking through unnecessary refs. For gerrit it can
also break valid requests because in gerrit "all" means "recent" and
the wanted-ref could fall out of the "recent" range when reloading all
refs at fetch time.

Treat wanted-refs like a ref-prefix when calculating the advertised
refs on v2 fetch command. Less refs means a faster setup and less walk
for the reachability checks. Note that wanted-refs filters only over
the refs visible to the user, so this doesn't give any extra
visibility to the caller.

If the request contains also "want <oid>" lines, we cannot use this
optimization. Those objects could be reachable from any visible
branch, not necessarily in the wanted-refs.

Google-Bug: b/122888978
Change-Id: I2a4ae171d4fc5d4cb30b020cb073ad23dd5a66c4

11 months agoBasePackFetchConnection: Avoid full clone with useNegotiationTip 80/204480/36
Ronald Bhuleskar [Thu, 21 Sep 2023 23:12:06 +0000 (16:12 -0700)]
BasePackFetchConnection: Avoid full clone with useNegotiationTip

With the useNegotiationTip flag (introduced in change 738dacb), the client sends to the server only the tips of the wanted refs for the negotiation. Some wanted refs may not exist in the client (yet) and our implementation ignores them. So when only non-existing refs are wanted, jgit doesn't send any tips and the server understands it is a full clone.

In useNegotiationTip, send ALL_REFS if any of the wanted refs does not exists locally.

Change-Id: Ide04c5df785b9212abcd9d3cba194515e0af166f

11 months ago.gitignore: ignore all Maven output directories `target/` 26/204826/7
Matthias Sohn [Thu, 5 Oct 2023 23:23:19 +0000 (01:23 +0200)]
.gitignore: ignore all Maven output directories `target/`

Change-Id: Ib405f3db99290fe9c1f1349759f6598819f1b886

11 months agobenchmarks: use org.eclipse.jgit-parent as parent pom 37/204837/3
Matthias Sohn [Sun, 8 Oct 2023 20:04:46 +0000 (22:04 +0200)]
benchmarks: use org.eclipse.jgit-parent as parent pom

Change-Id: I2248c12072adccaf2ba525da5dec4fb5b35ca383

11 months agoGenerate SBOMs using cyclonedx maven plugin 84/204784/3
Matthias Sohn [Thu, 5 Oct 2023 14:25:45 +0000 (16:25 +0200)]
Generate SBOMs using cyclonedx maven plugin

and specify JGit's license using its SPDX identifier.

See https://gitlab.eclipse.org/eclipsefdn/emo-team/sbom/-/blob/main/docs/sbom.adoc#sbom-maven

Change-Id: I8f022002c84200ea430325916fa38c3764979c02

11 months agoDfsPackFile: Do not attempt to read stream if pack doesn't have it 16/204916/2
Ivan Frade [Fri, 13 Oct 2023 21:06:37 +0000 (14:06 -0700)]
DfsPackFile: Do not attempt to read stream if pack doesn't have it

Other getters (e.g. bitmap or commit graph) cover the case that the
pack doesn't have the corresponding extension.

Do the same here to detect this early and avoid an IOException in
openFile.

Change-Id: I29726b7ede0f795d35543453a3e7f92cee872a78

11 months agoPackObjectSizeIndexLoader: Log wrong bytes on exception 17/204917/2
Ivan Frade [Fri, 13 Oct 2023 21:13:07 +0000 (14:13 -0700)]
PackObjectSizeIndexLoader: Log wrong bytes on exception

When the exception is thrown, we don't know if it is because the
stream didn't have data or had a wrong header.

Log the read bytes to differentiate these cases.

Change-Id: Ie7612eab39016f5ad7f1bfb2e07cab972dab796f

12 months agoSilence API warnings for API added in 5.13.3 60/204960/1
Matthias Sohn [Tue, 17 Oct 2023 09:25:12 +0000 (11:25 +0200)]
Silence API warnings for API added in 5.13.3

This was added in
f103a1d5c605 "Add support for git config repack.packKeptObjects"
f5f4bf0ad97f "Do not exclude objects in locked packs from bitmap
                processing"

Change-Id: Id6af9fe549535c4e92de9080a41ef9f72a6646dd

12 months agoFileBasedConfig: in-process synchronization for load() and save() 23/204923/1
Thomas Wolf [Sat, 14 Oct 2023 21:25:19 +0000 (23:25 +0200)]
FileBasedConfig: in-process synchronization for load() and save()

On Windows reading and replacing a file via renaming concurrently may
fail either in the reader or in the thread renaming the file. For
renaming, FileUtils.rename() has a last-case fallback in which it
deletes the target file before attempting the rename. If a reader reads
at that moment, it will produce an empty config, and the snapshot and
hash may be wrong because the concurrently running save() may set them.

It's not really possible to do all this in a thread-safe manner without
some synchronization. Add a read-write lock to synchronize readers and
writers to avoid at least that JGit steps on its own feet.

Bug: 451508
Change-Id: I7e5f0f26e02f34ba02dc925a445044d3e21389b4
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoFileUtils.rename(): better retry handling 22/204922/1
Thomas Wolf [Sun, 8 Oct 2023 20:03:22 +0000 (22:03 +0200)]
FileUtils.rename(): better retry handling

When the atomic move fails on Windows, it may be because some other
thread is currently reading the destination. If we delete the file
then, that reader may get an exception, and conclude the file didn't
exist, even though the rename() would re-create it right away.

Try to avoid this from happening frequently by only deleting the
destination on the last retry. Also don't sleep after the last attempt.

Bug: 451508
Change-Id: I95bb4ec59d6e7efb4a7fc8d67f5df301f690257a
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoFileBasedConfig: ensure correct snapshot if no file 21/204921/1
Thomas Wolf [Sun, 8 Oct 2023 19:53:06 +0000 (21:53 +0200)]
FileBasedConfig: ensure correct snapshot if no file

When no config file exists, use FileSnapshot.MISSING_FILE.

Bug: 451508
Change-Id: I8a09cb756a8a4746189da5b3514dfcf81d10b3b1
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoDeleteBranchCommand: update config only at the end 20/204920/1
Thomas Wolf [Sun, 8 Oct 2023 19:50:34 +0000 (21:50 +0200)]
DeleteBranchCommand: update config only at the end

When multiple branches were to be removed, the git config was updated
after each and every branch. Newly do so only once at the end, after all
branches have been deleted.

Because there may be an exception after some branches have already been
deleted, take care to update the config even if an exception is thrown.

Bug: 451508
Change-Id: I645be8a1a59a1476d421e46933c3f7cbd0639fec
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoConfig.removeSection() telling whether it changed the config 19/204919/1
Thomas Wolf [Sun, 8 Oct 2023 19:47:05 +0000 (21:47 +0200)]
Config.removeSection() telling whether it changed the config

Add a variant of unsetSection() that returns whether it did indeed
change the config. This can be used in to skip saving the config if
it was not changed.

Also fix the iteration over the entries: lastWasMatch was never reset,
and thus all empty lines after a match would be removed.

Change-Id: Iea9e84aa74b1e4bb3c89efe3936fa3a8a09532e5
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoRebaseCommand: return correct status on stash apply conflicts 13/204913/2
Thomas Wolf [Fri, 13 Oct 2023 18:00:06 +0000 (20:00 +0200)]
RebaseCommand: return correct status on stash apply conflicts

Ensure that also the fast-forward cases return status
STASH_APPLY_CONFLICTS when applying the stash produces conflicts.

Bug: 582526
Change-Id: Ib989ff431dca6e301eb05156ca054a7115fa6ad5
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoMerge branch 'stable-6.7' 35/204935/2
Matthias Sohn [Fri, 13 Oct 2023 19:31:00 +0000 (21:31 +0200)]
Merge branch 'stable-6.7'

* stable-6.7:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I7e0856a5d70d5d155cf6874383ea1f5622d5238a

12 months agoUse net.i2p.crypto.eddsa 0.3.0 from new Orbit build 34/204934/2
Matthias Sohn [Fri, 13 Oct 2023 08:15:08 +0000 (10:15 +0200)]
Use net.i2p.crypto.eddsa 0.3.0 from new Orbit build

consuming it directly from Maven Central.

The bundle net.i2p.crypto.eddsa 0.3.0 contains bad OSGi metadata,
earlier it was repackaged in Orbit tweaking its mandatory dependency to
sun.security.x509 to an optional dependency.

This project seems to be orphaned, probably because Java 15 added
support for eddsa with JEP339 [1].

This repackaged bundle is no longer available after Orbit was renovated
[2] to consume the vast majority of bundles directly from Maven Central
without repacking them. Hence we have to workaround this (probably
false) mandatory dependency. For that export an empty dummy package
"sun.security.x509" to satisfy OSGi.

[1] https://openjdk.org/jeps/339
[2] https://github.com/eclipse-orbit/orbit-simrel/issues/15

Change-Id: I2267e15823ebce6cf1d448e1e16a129f703e0f80

12 months agoMerge branch 'stable-6.6' into stable-6.7 30/204930/1
Matthias Sohn [Fri, 13 Oct 2023 07:06:21 +0000 (09:06 +0200)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I29241619e6c09933bb856e486f379be10dd609c2

12 months agoMerge branch 'stable-6.5' into stable-6.6 29/204929/1
Matthias Sohn [Fri, 13 Oct 2023 06:46:11 +0000 (08:46 +0200)]
Merge branch 'stable-6.5' into stable-6.6

* stable-6.5:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I7272a22451c0de6b4770767e7bb4e24c81518c20

12 months agoMerge branch 'stable-6.4' into stable-6.5 27/204927/2
Matthias Sohn [Thu, 12 Oct 2023 23:52:43 +0000 (01:52 +0200)]
Merge branch 'stable-6.4' into stable-6.5

* stable-6.4:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I2951d01f5f4581bee20079508cd8ee6ca8554f1f

12 months agoMerge branch 'stable-6.3' into stable-6.4 26/204926/2
Matthias Sohn [Thu, 12 Oct 2023 23:33:56 +0000 (01:33 +0200)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I4b94a2b79941c085fa2f62246e8e879aaa85cd3f

12 months agoMerge branch 'stable-6.2' into stable-6.3 28/204928/1
Matthias Sohn [Thu, 12 Oct 2023 22:51:46 +0000 (00:51 +0200)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I22b89bf00dcef26b2096d25397aa9a57a745a92b

12 months agoMerge branch 'stable-6.1' into stable-6.2 04/204904/1
Matthias Sohn [Thu, 12 Oct 2023 22:44:33 +0000 (00:44 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: Ib4e4fe407dce334c7537bf278baa39db93aa2f09

12 months agoMerge branch 'stable-6.0' into stable-6.1 03/204903/2
Matthias Sohn [Thu, 12 Oct 2023 22:33:19 +0000 (00:33 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: I0c9c0b3c206cac03a93b30eda348177a4de35c36

12 months agoMerge branch 'stable-5.13' into stable-6.0 02/204902/1
Matthias Sohn [Thu, 12 Oct 2023 22:22:11 +0000 (00:22 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  PackConfig: fix @since tags
  Remove unused API problem filters
  Add support for git config repack.packKeptObjects
  Do not exclude objects in locked packs from bitmap processing

Change-Id: Ifeaa4b4f0c5944d4ecd3042be429833ff72b43ed

12 months agoPackConfig: fix @since tags 01/204901/1
Matthias Sohn [Thu, 12 Oct 2023 22:19:12 +0000 (00:19 +0200)]
PackConfig: fix @since tags

Change-Id: Ia513f7cdbf3c197e8661720fc804984ff165fc5c

12 months agoRemove unused API problem filters 00/204900/1
Matthias Sohn [Thu, 12 Oct 2023 22:18:59 +0000 (00:18 +0200)]
Remove unused API problem filters

Change-Id: I9d5b96cf841478af8613667ef8574423630f8028

12 months agoAdd support for git config repack.packKeptObjects 20/204820/8
Antonio Barone [Thu, 5 Oct 2023 19:58:13 +0000 (21:58 +0200)]
Add support for git config repack.packKeptObjects

Change Ide3445e652 introduced the `--pack-kept-objects` option to GC for
including the objects contained in the locked packfiles during the
repack phase.

Whilst this allowed to explicitly pass a command line argument to the
jgit gc program, it did not allow the option to be read from
configuration.

Allow the pack kept objects option to be configured exactly as C-Git
documents [1], by introducing a new `repack.packKeptObjects`
configuration.

`repack.packKeptObjects` defaults to `true`, when the
`pack.buildBitmaps` is `true` (which is the default case), `false`
otherwise.

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

Bug: 582292
Change-Id: Ia931667277410d71bc079d27c097a57094299840

12 months agoDo not exclude objects in locked packs from bitmap processing 25/203625/21
Luca Milanesio [Fri, 11 Aug 2023 19:15:17 +0000 (20:15 +0100)]
Do not exclude objects in locked packs from bitmap processing

Packfiles having an equivalent .keep file are associated with in-flight
pushes that haven't been completed, with potentially a set of git
objects not yet referenced by a ref.

If the Git client is not up-to-date, it may result in pushing a
packfile, generating a <packfile>.keep on the server, which
may also contain existing commits due to the lack of Git protocol
negotiation in the git-receive-pack.

The Git protocol negotiation is the phase where the client and the
server exchange the list of refs they have for trying to find a common
base and minimise the amount of objects to be transferred.

The repack phase in GC was previously skipping all objects that were
contained in all packfiles having a <packfile>.keep file associated
(aka "locked packfiles"), which did not take into consideration the
fact that excluding the existing commits would have resulted in the
generation of an invalid bitmap file.

The code for excluding the objects in the locked packfiles was written
well before the bitmap was introduced, hence could not consider a use
case that did not exist at that time.

However, when the bitmap was introduced, the exclusion of locked
packfiles was not changed, hence creating a potential problem.
The issue went unnoticed for many years because the bitmap generation
was disabled when JGit noticed any locked packfiles; however, the
bitmaps are enabled again since  Id722e68d9f , and the the issue is now
visible and is impacting the GC repack phase.

Introduce the '--pack-kept-objects' option in GC for including the
objects contained in the locked packfiles during the repack phase,
which is not an issue because of the following:

- If there are any existing commits duplicated in the packfiles
  they will be just considered once anyway because the repack doesn't
  generate duplicates in the output packfile.

- If there are any new commits that do not have any ref pointing to
  them, they will be automatically excluded from the output repacked
  packfile.

The same identical solution is adopted in the C implementation of git
in repack.c.

Because the locked packfile is not pruned, any new commits not pointed
by any refs will remain in the repository and there will not be any
accidental pruning or object loss as it is today before this change.

As a side-effect of this change, it is now potentially possible to still
have duplicate BLOBs after GC when the keep packfile contained existing
objects. However, it is way better to keep the duplication until the
next GC phase rather than omitting existing objects from repacking and,
therefore generating an invalid bitmap and incorrect packfile.

Bug: 582292
Bug: 582455
Change-Id: Ide3445e652fcf256a7912f881cb898897c99b8f8

12 months agoMerge changes Ibd71a992,Ib7fa7cb7
Matthias Sohn [Mon, 9 Oct 2023 22:43:10 +0000 (18:43 -0400)]
Merge changes Ibd71a992,Ib7fa7cb7

* changes:
  [errorprone] Fix InconsistentCapitalization
  Update orbit to orbit-aggregation/2023-12

12 months ago[errorprone] Fix InconsistentCapitalization 83/204783/1
Matthias Sohn [Thu, 5 Oct 2023 14:46:21 +0000 (16:46 +0200)]
[errorprone] Fix InconsistentCapitalization

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

Change-Id: Ibd71a992128ca2e5f916a08dd11da67c5a2f8aad

12 months agoTestRepository: Add getInstant method 21/204821/1
David Ostrovsky [Thu, 5 Oct 2023 21:04:00 +0000 (23:04 +0200)]
TestRepository: Add getInstant method

Error Prone is flagging Date-API as obsolete and recommends to migrate
to Instant and LocalDate. Given that more JGit users starting to migrate
to new Time API, offer getInstant method.

Change-Id: Ie010b76d1c213cd0a645f716783ed2d57fc78071

12 months agoUpdate orbit to orbit-aggregation/2023-12 82/204782/1
Matthias Sohn [Wed, 4 Oct 2023 08:35:30 +0000 (10:35 +0200)]
Update orbit to orbit-aggregation/2023-12

- add target platform for Eclipse 4.30 (2023-12)
- update org.apache.ant to 1.10.14

Change-Id: Ib7fa7cb79e93ecd6009784bc0ad4269bfa71cb29

12 months agoMerge branch 'stable-6.8' 72/204772/1
Matthias Sohn [Tue, 3 Oct 2023 18:12:28 +0000 (20:12 +0200)]
Merge branch 'stable-6.8'

* stable-6.8:
  Prepare 6.8.0-SNAPSHOT builds
  JGit v6.8.0.202310031045-m1

Change-Id: I6a6526fee84e15bb463a6ce0a0548a8b82ea7e4e

12 months agoPrepare 6.8.0-SNAPSHOT builds 70/204770/1
Matthias Sohn [Tue, 3 Oct 2023 18:10:22 +0000 (20:10 +0200)]
Prepare 6.8.0-SNAPSHOT builds

Change-Id: Idb86bac4bd152e57f1810c789bdbd26648f0b6ae

12 months agoJGit v6.8.0.202310031045-m1 68/204768/1 v6.8.0.202310031045-m1
Matthias Sohn [Tue, 3 Oct 2023 14:41:57 +0000 (16:41 +0200)]
JGit v6.8.0.202310031045-m1

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

12 months agoUploadPack: Delay freeing refs in sendPack() 10/204710/1
Ivan Frade [Thu, 28 Sep 2023 22:06:40 +0000 (15:06 -0700)]
UploadPack: Delay freeing refs in sendPack()

Change [1] set refs to null at the beggining of sendPack claiming they
are not needed anymore, but they are still used few lines below to
hoist referenced objects to the front of the pack. With refs nullified,
the hoist doesn't happened. This hasn't caused any problem so far,
probably because it is just an optimization and the objects are in the
pack anyway.

Move the nullification after the hoisting to keep the optimization and
save the memory.

[1] https://git.eclipse.org/r/c/jgit/jgit/+/161341

Change-Id: I8455249d8482f616af362d3912b718064d473b49

12 months agoMerge "Fix log level for successful execution of ShutdownHook#notify to debug"
Thomas Wolf [Tue, 26 Sep 2023 21:40:52 +0000 (17:40 -0400)]
Merge "Fix log level for successful execution of ShutdownHook#notify to debug"

12 months agoByteBufferInputStream: add missing @since 6.8 49/204649/1
Thomas Wolf [Tue, 26 Sep 2023 21:11:07 +0000 (23:11 +0200)]
ByteBufferInputStream: add missing @since 6.8

Change-Id: I80574a514ade608b87bed2dae79851e53a850c31
Signed-off-by: Thomas Wolf <twolf@apache.org>
12 months agoFix log level for successful execution of ShutdownHook#notify to debug 30/204630/1
Matthias Sohn [Tue, 26 Sep 2023 20:38:49 +0000 (22:38 +0200)]
Fix log level for successful execution of ShutdownHook#notify to debug

This is debug trace and shouldn't be logged as a warning.

Change-Id: Ibb24e91e857a05aa6b74b0e2c5b11ab057f6206a

12 months agoEclipse features: update copyright year 21/204621/1
Thomas Wolf [Tue, 12 Sep 2023 18:59:12 +0000 (20:59 +0200)]
Eclipse features: update copyright year

Set upper bound to 2023.

Change-Id: I67acc12b3fe80ab7ca4a9303b0e96325a1e707e9
Signed-off-by: Thomas Wolf <twolf@apache.org>