Commit Graph

9778 Commits (motiejus-detectSymlinkSupport)

Author SHA1 Message Date
Motiejus Jakštys ab2d63322f FS.detectSymlinkSupport: fix a race
When >1 JGit clients are instantiated concurrently, they may try to
create the same symlink at the same time. When that happens, the second
thread will return an error (because the symlink already exists) and
that `FS` instance will think that symlinks are not supported, causing
havoc.
2023-12-28 16:40:31 +02:00
Matthias Sohn b1cc74b75b Update maven plugins
- com.github.siom79.japicmp:japicmp-maven-plugin to 0.18.3
- com.github.spotbugs:spotbugs-maven-plugin to 4.8.2.0
- io.github.git-commit-id:git-commit-id-maven-plugin to 7.0.0
- org.apache.maven.plugins:maven-clean-plugin to 3.3.2
- org.apache.maven.plugins:maven-compiler-plugin to 3.12.0
- org.apache.maven.plugins:maven-dependency-plugin to 3.6.1
- org.apache.maven.plugins:maven-enforcer-plugin to 3.4.1
- org.apache.maven.plugins:maven-javadoc-plugin to 3.6.3
- org.apache.maven.plugins:maven-jxr-plugin to 3.3.1
- org.apache.maven.plugins:maven-pmd-plugin to 3.21.2
- org.apache.maven.plugins:maven-project-info-reports-plugin to 3.5.1
- org.apache.maven.plugins:maven-shade-plugin to 3.5.1
- org.apache.maven.plugins:maven-site-plugin to 4.0.0-M13
- org.apache.maven.plugins:maven-surefire-plugin to 3.2.3
- org.codehaus.mojo:build-helper-maven-plugin to 3.5.0
- org.cyclonedx:cyclonedx-maven-plugin to 2.7.10
- org.eclipse.cbi.maven.plugins:eclipse-jarsigner-plugin to 1.4.3
- org.jacoco:jacoco-maven-plugin to 0.8.11

Change-Id: Ie146085f567f0bcfe0124627939382fe5a764e6c
2023-12-23 01:02:09 +01:00
Matthias Sohn 2199b74cec Update org.eclipse.dash:license-tool-plugin to 1.1.0
Change-Id: I039e10fc6790d54c30cfd85a53c05604351996e0
2023-12-23 01:01:39 +01:00
Matthias Sohn ff20da9b89 Enable using slf4j 2.x
Eclipse platform moved to sfl4j 2.x. Hence relax version constraint so
that both 1.7 and 2.x are allowed.

Bug: egit-5
Change-Id: Ie0b00310d8f3f2553457c8668a38978a67b8febe
2023-12-22 23:20:41 +01:00
Matthias Sohn 80a2b067f3 Update Tycho to 4.0.4
Change-Id: I9d087b5a62ab3d474d894a2276572156c14dad4e
2023-12-22 23:20:41 +01:00
Matthias Sohn b450ff1800 Update mockito to 5.8.0
Change-Id: I70d33b7af25fcb4754fb048dd9054eef7356f00c
2023-12-22 23:20:40 +01:00
Matthias Sohn 3cefca0940 Add 4.31 target platform and update orbit to 4.31
and update bytebuddy to 1.14.10.

Change-Id: I145776a31d806f7e6dcc90263650109b3eb19067
2023-12-22 23:20:40 +01:00
Matthias Sohn a00afad545 Update ecj to 3.36.0
Change-Id: I803de19e8086239ebbae9877121946fdddfbaa89
2023-12-22 23:20:40 +01:00
Matthias Sohn d1189a1cd3 Renormalize line endings based on .gitattributes
This fixes line endings of all text files to use LF in the repository.

Change-Id: I4df6fd7aaf9db9cdaa953a0d1062981b4612056c
2023-12-22 23:20:40 +01:00
Matthias Sohn eb0dd3a4eb Configure .gitattributes to manage line endings
Mark test resources as binary to prevent line ending normalization
Some of the test resources are used to test handling of line endings
in JGit.

Change-Id: Idd9ba604945797d1cd1f3af1a1987aee3188e1d6
2023-12-22 23:20:39 +01:00
Matthias Sohn 40e97af2d8 Normalize line endings to LF for all text files
Change-Id: I69753494e4c7db4c0a8e6eca3b3e63d3ff561117
2023-12-22 23:20:39 +01:00
Matthias Sohn a423f17c8a Merge "Remove invalid spotbugs configuration" 2023-12-22 19:23:44 +00:00
Matthias Sohn aab576cd18 Merge "Fix PMD plugin configuration" 2023-12-22 19:21:33 +00:00
Dariusz Luksza 7884873160 BasePackFetchConnection: Skip object/ref lookups if local repo is empty
When cloning repository some of the operations in
`BasePackFetchConnection` can be skipped. We don't need to advertise
packs, compute "wanted time" or wanted refs to send. All of those
operations will try to read objects from an empty repository which
always results in a missing object.

This saves 99.9% of `LooseObjects.open()` calls which dramatically
speeds up object negotiation in V2 protocol.

In testing on JGit (v6.8.0.202311291450-r) repository, which contains
564 refs, the number of calls to `LooseObjects.open()` was reduced from
1187 to 1.

Skipping a call to `markRefsAdvertised()` initially reduced be above
number to 623. Then assuming "0" "want time" an on empty repository
pushed the calls down to 312. Finally, skipping objects reachability on
empty repository set calls down to 1.

The last call is performed from `FetchProcess.asForIsComplete()` which
probably needs to stay in place.

Bug: jgit-5
Change-Id: I2480690726ea54d3b1593380bc8f8d15b4d6afc6
2023-12-20 08:31:14 +00:00
Dariusz Luksza faa50c683d LooseObjects: Use File#exists when possible
When `trustFolderStat` flag is enabled we can use `File.exist()`
instead of rethrowing `FileNotFoundException`. This improves performance
of cloning and fetching.

A simple benchmark that generates a random `ObjectId` instance and then
tries to parse that object id, shows about 30% improvement with this
change.

The benchmark scenario was based on the stacktrace reported in jgit-5.
Where `RevWalk.parse()` call will eventually call `LooseObjects.open()`
and finally `LoseObjects.getOpenLoader()`.

Results on `master`:
  (packFiles)  Mode  Cnt        Score   Error  Units
           10  avgt    2      137.400          us/op
          100  avgt    2     1369.063          us/op
         1000  avgt    2    13730.759          us/op
        10000  avgt    2   137359.539          us/op
       100000  avgt    2  1382627.641          us/op

With this change:
  (packFiles)  Mode  Cnt        Score   Error  Units
           10  avgt    2       85.019          us/op
          100  avgt    2      868.748          us/op
         1000  avgt    2     8628.768          us/op
        10000  avgt    2    86877.505          us/op
       100000  avgt    2   863123.868          us/op

Issue: jgit-5
Change-Id: I366acf629873a5c7577a1032490faf57685f98dd
2023-12-20 08:00:10 +00:00
Michael Keppler 1ab2c73b48 Remove invalid spotbugs configuration
* findbugsXmlOutput was renamed to spotbugsXmlOutput long ago
* spotbugsXmlOutput has a default value of true and is deprecated,
therefore removing the entire line seems most reasonable

See https://spotbugs.github.io/spotbugs-maven-plugin/check-mojo.html#spotbugsXmlOutput

Change-Id: I83c0bbce1fb3622accb13978319b4313b0121655
2023-12-17 15:45:18 +01:00
Michael Keppler 5553f3b304 Fix PMD plugin configuration
The configuration element has been renamed in release 3.18, see
https://github.com/apache/maven-pmd-plugin/releases/tag/maven-pmd-plugin-3.18.0

Change-Id: Ia6ec6992c4348d77d4b61f34190a57775cc30cec
2023-12-17 15:30:35 +01:00
Ivan Frade b2abab271a DfsReader: give subclasses visiblity over the pack bitmap index
Subclasses intercept many methods in DfsReader to capture metrics, but
they cannot record stats from PackBitmapIndex, as it is wrapped inside
a BitmapIndex.

Move the creation of the BitmapIndex to a protected method. Subclasses
can override it to e.g. read metrics from the index or set listeners to
the BitmapIndex.

Change-Id: I86c13b3ef88663d7faf59f2ec77df0a36b1627ed
2023-12-14 15:42:44 -08:00
Ivan Frade e25bf95738 PackBitmapIndex/StoredBitmap: Expose size and counts
PackBitmapIndex holds a collection of StoredBitmaps. StoredBitmaps can
be either base bitmaps (ready) or an XOR over another bitmap. XOR
bitmaps are replaced with a resolved version on demand. Bitmaps
can use a significant amount of memory but we don't have detailed
visibility about it.

Add methods to PackBitmapIndex to know how many xor/bases we have and
their sizes.

Change-Id: I57aa80a1f07ddf9223eb34cfda85aab85529ea9c
2023-12-14 15:42:41 -08:00
Ivan Frade 52c18ae15f PackWriter/Statistics: Remove the bitmapt hit stats
The request uses bitmaps for reachability and to decide what to
pack. Setting the listener in the PackWriter only covers the second
case.

Remove the listener from the PackWriter. It makes more sense to set it
in the reader and at the moment the BitmapIndex only supports a single
listener.

This was introduced after the 6.8 tag, so it should be safe to remove.

Change-Id: Ib4c0a805c70e54b6a9e7f78ccdb8e0a465d238f1
2023-12-13 10:57:26 -08:00
Thomas Wolf a2fed42939 Configure Github issue reporting
Add two forms for bug reports and feature requests.

Change-Id: I8d80f2498741ba5bb88655d1e22798f99826fb7f
2023-12-10 17:02:10 +01:00
Thomas Wolf 4d2bdba326 Merge "API filter for PackStatistics.objectsWithBitmapsFound" 2023-12-06 08:24:45 +00:00
Kamil Musin ab132937fb FooterLine: Protect from ill-formed message
A raw commit message has some headers and then the actual
message. RawParseUtils.commitMessage returns the start position of the
actual message, or -1 when the message is not raw. FooterLine is not
handling this -1 and throws an IndexOutOfBounds exception.

Consider than msgB can be -1 when looking for the beginning of the
last paragraph.

FooterLine javadoc and parameter talk only about "raw" but previous
code accepted non-raw messages (used mostly in unit tests) so we need
to keep this behavior.

Change-Id: I4b88c507e210fdd200a85b01665c8524ab393b00
2023-12-05 16:00:41 -08:00
Ivan Frade f75e8fb425 Merge "Document option gc.writeCommitGraph" 2023-12-05 18:39:19 +00:00
Thomas Wolf 4592603b96 API filter for PackStatistics.objectsWithBitmapsFound
The field was introduced in commit 5e563e1b.

Change-Id: Ic2f495e79319ac6044bcabf253b63b8b631eec84
2023-12-05 16:06:09 +01:00
Ivan Frade 072f4e5207 Merge "StartGenerator: Fix parent rewrite with non-default RevFilter" 2023-12-04 23:38:57 +00:00
Ronald Bhuleskar db5ce6b5c2 StartGenerator: Fix parent rewrite with non-default RevFilter
StartGenerator is responsible for propagating the RevWalk's
parent rewrite setting, but it currently only does so when a
non-default TreeFilter is set, when it should also do so if
the default TreeFilter is used with a non-default RevFilter.

Adding a new if condition within StartGenerator to enable parent
rewrite with non-default RevFilter.

TreeRevFilter relied on the old buggy functionality and has
been modified to explicitly refrain from rewriting parents.

Change-Id: I4e4ff67fb279edbcc3461496b132cea774fb742f
2023-12-04 15:01:17 -08:00
Peter Kriens 6a5bde5681 Update MANIFEST.MF
Add an import for javax.net.ssl

Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>
2023-12-04 22:48:53 +00:00
Matthias Sohn b05894436a Document option gc.writeCommitGraph
Change-Id: Ic02d5abce18250b30f2c3f3741892d8cda251001
2023-12-04 23:12:46 +01:00
Matthias Sohn 6cdd04aa46 Bump last release version to 6.8.0.202311291450-r
This is the version used to compare API changes against to detect
breaking API changes.

Change-Id: I005b6a24c98c507656ebab415492a4127f08d471
2023-12-04 23:12:46 +01:00
Matthias Sohn b54592c8ee Prepare 6.9.0-SNAPSHOT builds
Change-Id: Id1d784ec4870cfb53c4b140fe0bb3fad9eef651d
2023-12-04 23:02:44 +01:00
Matthias Sohn c1e5bd348d Merge branch 'stable-6.8'
* stable-6.8:
  Prepare 6.8.1-SNAPSHOT builds
  JGit v6.8.0.202311291450-r
  Rename method parameter to fix warning about hidden field
  Fix warnings about empty control flow statements
  BitmapIndexImpl: externalize error message
  Suppress not-externalized string warnings
  Silence API error for new method BitmapIndex#addBitmapLookupListener
  Update Orbit to orbit-aggregation/2023-12
  Prepare 6.8.0-SNAPSHOT builds
  JGit v6.8.0.202311212206-rc1

Change-Id: Ie88662f6458bb80147c7c164424eebd8b8240fc7
2023-12-04 22:58:45 +01:00
Ivan Frade 8ea5409ec1 BitmapWalkerTest: New test for the walker
Change-Id: I414f5bdd86e5623d7669fa187df19e06acd02cef
2023-11-30 11:58:32 -08:00
Ivan Frade 5e563e1ba1 PackWriter: store the objects with bitmaps in the statistics
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.

Use the listener interface of the BitmapWalker to get the objects
walked with bitmaps and store them in the statistics.

Change-Id: Id15a904eb642d7f50d80ac77d1146db4fe4706eb
2023-11-30 11:58:32 -08:00
Ivan Frade 5552242588 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
2023-11-29 14:18:12 -08:00
Ivan Frade acf97be2d6 Reapply "Improve footer parsing to allow multiline footers."
This reverts commit e99fb6edc4.
2023-11-29 13:44:02 -08:00
Ivan Frade e99fb6edc4 Revert "Improve footer parsing to allow multiline footers."
This reverts commit 340cc787a0.

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
2023-11-29 10:05:07 -08:00
Matthias Sohn 796fb2e5c7 Prepare 6.8.1-SNAPSHOT builds
Change-Id: I56458c5345dcd9544868c948e90c9827d25c6850
2023-11-29 16:53:24 +01:00
Matthias Sohn c43560487b JGit v6.8.0.202311291450-r
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: Iecfe3f628cfdc437ee0d63fe52653ef952c8c494
2023-11-29 15:49:43 +01:00
Matthias Sohn 6514a46a3b Rename method parameter to fix warning about hidden field
Change-Id: Id094ab022f82db0f3eb220052adc0aed1cde2d50
2023-11-29 00:21:31 +01:00
Matthias Sohn 29ad7d56e8 Fix warnings about empty control flow statements
Change-Id: If1595ac148edf88a18efdd90c4f40d0ac719caab
2023-11-29 00:18:29 +01:00
Matthias Sohn e4abd0123b BitmapIndexImpl: externalize error message
Change-Id: I5189e966aecc57fe7c3e6c3f7f8e6b16917ee27f
2023-11-29 00:12:55 +01:00
Matthias Sohn 232813bfcd Suppress not-externalized string warnings
Change-Id: I2a0a588227d451cb175e17eef20ecb6fe9e9ef80
2023-11-29 00:09:52 +01:00
Matthias Sohn ff0ec5c612 Silence API error for new method BitmapIndex#addBitmapLookupListener
it has an empty default implementation.

Change-Id: I56b16c48992652a4ddaaf4c0435e08452c65749e
2023-11-29 00:04:18 +01:00
Matthias Sohn 5a717a7054 Update Orbit to orbit-aggregation/2023-12
Change-Id: Ifde28f60461e0a9d7b1278f8f178ceb2c4e1db7a
2023-11-28 23:53:29 +01:00
Matthias Sohn 5fdd58ae3c Merge branch 'master' into stable-6.8
* master:
  Adapt to type parameter added in commons-compress 1.25.0
  Improve footer parsing to allow multiline footers.
  Make the tests buildable by bazel test
  BitmapIndex: Add interface to track bitmaps found (or not)
  BitmapWalker: Remove BitmapWalkListener

Change-Id: Id2aeb0acd37bdd68a2f2c9f09f4d442fa40c9dd1
2023-11-27 23:34:02 +01:00
Matthias Sohn 42666cca34 Merge "Improve footer parsing to allow multiline footers." 2023-11-26 18:35:54 +00:00
Matthias Sohn e9433d338c Merge "Make the tests buildable by bazel test" 2023-11-25 19:54:02 +00:00
Matthias Sohn ef901e9aea 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
2023-11-24 18:22:07 +00:00
Kamil Musin 340cc787a0 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
2023-11-24 15:39:02 +01:00