]> source.dussan.org Git - jgit.git/log
jgit.git
8 months agoAdd tests for handling pack files removal during fetch 46/205546/6
Dariusz Luksza [Fri, 17 Nov 2023 19:28:53 +0000 (19:28 +0000)]
Add tests for handling pack files removal during fetch

Although this could sound like a corner case, it really can occur out
there in the real world. Especially in the Gerrit world where the
repositories could be GC'ed on a separate process or system.

The `FileNotFoundException` seems to be handled correctly in
`PackFile#doOpen` (line 671) and it will mark the pack as invalid. But
triggering that code path was not an easy task.

First of all, we need to add a new commit to the `master` branch of the
test repository after `UploadPack` object is created.

Secondly, in the refspec for fetch, commit id instead of "regular"
refspec must be used.

With both in place, we can see a warning log statement about deleted
pack file. And the fetch succeeds!

Also, tests for the removal of *.idx and *.bitmap files were added.

This unveiled a corner for the *.idx file deletion while fetching, as
the test will fail with "Unreachable pack index" IOException only
when the HEAD commit is empty.

Change-Id: If26c83f9b12993d1ab7d6bad6bd863c29520b062
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
8 months agoMerge "Remove invalid/unnecessary Maven settings"
Matthias Sohn [Tue, 16 Jan 2024 22:14:04 +0000 (22:14 +0000)]
Merge "Remove invalid/unnecessary Maven settings"

9 months agoMerge "PackWriterBitmapPreparer: Set limit on excessive branch count"
Ivan Frade [Fri, 12 Jan 2024 23:40:21 +0000 (23:40 +0000)]
Merge "PackWriterBitmapPreparer: Set limit on excessive branch count"

9 months agoPackWriterBitmapPreparer: Set limit on excessive branch count 07/1174407/21
Jackson Toeniskoetter [Wed, 10 Jan 2024 21:34:48 +0000 (21:34 +0000)]
PackWriterBitmapPreparer: Set limit on excessive branch count

If there are too many branches then the bitmap
indexing selects only the tip commits of the least active
branches to reduce the amount of bitmaps to load on request.
This can still be a problem if the number of inactive branches
rival or exceed the total number of commits selected
for the active branches.

Limit the number of branches that receive only-tip bitmaps.
This reduces the memory pressure of loading all the bitmaps,
and allows us to model the size of the bitmap index without
considering the number of branches.

Bitmaps are generated for branches in order of most recent commit,
and follow these rules:

* The first {@code DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT} most active
  branches have full bitmap coverage.
* The {@code DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT} to {@code
  DEFAULT_BITMAP_EXCESSIVE_BRANCH_TIP_COUNT} most active branches have
  only the tip commit covered.
* The remaining branches have no bitmap coverage.

To prevent effecting existing repositories, the default value is set
at Integer.MAX_VALUE.

Change-Id: I7cc53c898cdc04953b95669be0b069543e10c6f8

9 months agoUpdate jna to 5.14.0 90/1173390/5
Matthias Sohn [Fri, 15 Dec 2023 23:23:47 +0000 (00:23 +0100)]
Update jna to 5.14.0

Change-Id: Ie60f618fabd1c35815a7fe2775b7fe059baba8b4

9 months agoMerge "DfsInserter/PackParser: keep min size for index in the inserter"
Ivan Frade [Thu, 11 Jan 2024 21:29:58 +0000 (21:29 +0000)]
Merge "DfsInserter/PackParser: keep min size for index in the inserter"

9 months agoDfsInserter/PackParser: keep min size for index in the inserter 19/1174419/3
Ivan Frade [Wed, 10 Jan 2024 23:36:24 +0000 (15:36 -0800)]
DfsInserter/PackParser: keep min size for index in the inserter

Both, inserter and packparser read the minimum size for the object
size index. The writing is invoked from both classes but done only by
the inserter.

Let the inserter read and handle the conf. Do this in the constructor
and allow override so some paths can hardcode a value.

Change-Id: I890cadd29678a53738761f4b0ab13020d6353f3e

9 months agoMerge branch 'stable-6.8' 12/1174312/1
Matthias Sohn [Wed, 10 Jan 2024 22:58:02 +0000 (23:58 +0100)]
Merge branch 'stable-6.8'

* stable-6.8:
  Silence API warnings
  Make sure ref to prune is in packed refs
  Checkout: better directory handling

Change-Id: Ief6e4d6cd3fcea327f28c32643b8323f5d0c6936

9 months agoMerge branch 'stable-6.7' into stable-6.8
Matthias Sohn [Wed, 10 Jan 2024 22:47:13 +0000 (23:47 +0100)]
Merge branch 'stable-6.7' into stable-6.8

* stable-6.7:
  Silence API warnings
  Make sure ref to prune is in packed refs
  Checkout: better directory handling

Change-Id: Ie8c433e14d025055aa6ce674d6d1220fe1354785

9 months agoMerge branch 'stable-6.6' into stable-6.7 10/1174310/1
Matthias Sohn [Wed, 10 Jan 2024 22:45:20 +0000 (23:45 +0100)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Silence API warnings
  Make sure ref to prune is in packed refs
  Checkout: better directory handling

Change-Id: Id3b01c7a583d45b4e67e3f993006a5646f77a41d

9 months agoMerge branch 'stable-6.5' into stable-6.6 09/1174309/1
Matthias Sohn [Wed, 10 Jan 2024 22:44:46 +0000 (23:44 +0100)]
Merge branch 'stable-6.5' into stable-6.6

* stable-6.5:
  Checkout: better directory handling

Change-Id: I1712191514b8c1b9ea048974376a6765ff7970c7

9 months agoMerge branch 'stable-6.4' into stable-6.5 08/1174308/1
Matthias Sohn [Wed, 10 Jan 2024 22:44:17 +0000 (23:44 +0100)]
Merge branch 'stable-6.4' into stable-6.5

* stable-6.4:
  Checkout: better directory handling

Change-Id: I68e11fb06a354961f4146de51d326b69be5b69d3

9 months agoMerge branch 'stable-6.3' into stable-6.4 07/1174307/1
Matthias Sohn [Wed, 10 Jan 2024 22:43:50 +0000 (23:43 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Checkout: better directory handling

Change-Id: Ie0fefa8afc07f638ee05a46d272db7b7b0f8d464

9 months agoMerge branch 'stable-6.2' into stable-6.3 06/1174306/1
Matthias Sohn [Wed, 10 Jan 2024 22:43:17 +0000 (23:43 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Checkout: better directory handling

Change-Id: Id27612578f822cabc1a38ad1f8e859ae354045a9

9 months agoMerge branch 'stable-6.1' into stable-6.2 05/1174305/1
Matthias Sohn [Wed, 10 Jan 2024 22:42:47 +0000 (23:42 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Checkout: better directory handling

Change-Id: I2f8e5410f4962d38bc6e822b5cda42df68aef32b

9 months agoMerge branch 'stable-6.0' into stable-6.1
Matthias Sohn [Wed, 10 Jan 2024 22:42:07 +0000 (23:42 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Checkout: better directory handling

Change-Id: Ide9fb318b5fe413d73d73a19943c6dacdcf07f3d

9 months agoMerge branch 'stable-5.13' into stable-6.0 03/1174303/1
Matthias Sohn [Wed, 10 Jan 2024 19:56:19 +0000 (20:56 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Checkout: better directory handling

Revert commit 170244d05977491271a1cc234583d2e5ba75145d
"Checkout: better directory handling" which is the downport of the
original fix Ie12864c54c9f901a2ccee7caddec73027f353111 which was done
on stable-6.6. Merging this up to stable-6.6 would be a lot of work and
these branches aren't maintained anymore hence revert this change here.
This way the fix is available on stable-5.13 for those who still need
Java 8 and everybody else should upgrade to 6.6.1 or higher.

Change-Id: Iffe50a5e62c6655814265d9cc6c5c2996baa1a31

9 months agoMerge "FooterLines: handle extraction from messages without headers"
Ivan Frade [Tue, 9 Jan 2024 17:41:58 +0000 (17:41 +0000)]
Merge "FooterLines: handle extraction from messages without headers"

9 months agoFooterLines: handle extraction from messages without headers 44/1173244/8
Nitzan Gur-Furman [Wed, 6 Dec 2023 13:47:27 +0000 (14:47 +0100)]
FooterLines: handle extraction from messages without headers

Prior to this change, long subjects of messages with no headers were
treated as headers, and therefore were skipped. In a message of the
form `<long subject>\n\n<footers>`, the footers would then get parsed
as a message, meaning no footers were returned.

After this change, the first lines are skipped only if they match any
of the known headers. The first line ofter the optional headers is then
assumed to be the subject line.

`FooterLineTest` had a few test cases for extracting footers from
messages with no headers. However, there were all with short messages,
so the "skip this line" logic in `RawParseUtils` was never triggered.
Added test case to catch this issue.

Change-Id: I971a1dddf1a9aea094360c3c8fc3b9a8b011bbf9
Issue: Google b/287891316

9 months agoSilence API warnings 02/1174302/1
Matthias Sohn [Mon, 8 Jan 2024 08:33:59 +0000 (09:33 +0100)]
Silence API warnings

Change-Id: I44084c45ed2c5e642021d1de4f37af769e4b317f

9 months agoRemove invalid/unnecessary Maven settings 31/1174031/1
Michael Keppler [Sat, 23 Dec 2023 19:31:11 +0000 (20:31 +0100)]
Remove invalid/unnecessary Maven settings

* Remove jgit.target POM and remove it from the module list. This was
only necessary when the target file had to be referenced as an artifact.
Meanwhile we reference it directly by its path, and can remove the Maven
build around it.

* Remove tycho configuration options that are no longer valid (resolved
was removed very early, probably before 1.0; includePackedArtifacts was
removed in 3.0). Also remove duplicate version specification.

Change-Id: Ifa69065dd73bf586b8359541375e065f5f60aa03

9 months agoUpdate maven plugins 46/1174046/1
Matthias Sohn [Fri, 22 Dec 2023 23:39:07 +0000 (00:39 +0100)]
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

9 months agoUpdate org.eclipse.dash:license-tool-plugin to 1.1.0 45/1174045/1
Matthias Sohn [Fri, 22 Dec 2023 23:15:00 +0000 (00:15 +0100)]
Update org.eclipse.dash:license-tool-plugin to 1.1.0

Change-Id: I039e10fc6790d54c30cfd85a53c05604351996e0

9 months agoEnable using slf4j 2.x 85/1173385/7
Matthias Sohn [Sun, 10 Dec 2023 22:55:40 +0000 (23:55 +0100)]
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

9 months agoUpdate Tycho to 4.0.4 86/1173386/4
Matthias Sohn [Sun, 10 Dec 2023 21:23:31 +0000 (22:23 +0100)]
Update Tycho to 4.0.4

Change-Id: I9d087b5a62ab3d474d894a2276572156c14dad4e

9 months agoUpdate mockito to 5.8.0 84/1173384/3
Matthias Sohn [Sat, 9 Dec 2023 23:08:09 +0000 (00:08 +0100)]
Update mockito to 5.8.0

Change-Id: I70d33b7af25fcb4754fb048dd9054eef7356f00c

9 months agoAdd 4.31 target platform and update orbit to 4.31 83/1173383/3
Matthias Sohn [Sat, 9 Dec 2023 22:58:25 +0000 (23:58 +0100)]
Add 4.31 target platform and update orbit to 4.31

and update bytebuddy to 1.14.10.

Change-Id: I145776a31d806f7e6dcc90263650109b3eb19067

9 months agoUpdate ecj to 3.36.0 82/1173382/3
Matthias Sohn [Sat, 9 Dec 2023 22:49:56 +0000 (23:49 +0100)]
Update ecj to 3.36.0

Change-Id: I803de19e8086239ebbae9877121946fdddfbaa89

9 months agoRenormalize line endings based on .gitattributes 51/1173051/3
Matthias Sohn [Fri, 24 Nov 2023 16:03:09 +0000 (17:03 +0100)]
Renormalize line endings based on .gitattributes

This fixes line endings of all text files to use LF in the repository.

Change-Id: I4df6fd7aaf9db9cdaa953a0d1062981b4612056c

9 months agoConfigure .gitattributes to manage line endings 50/1173050/3
Matthias Sohn [Fri, 24 Nov 2023 14:14:58 +0000 (15:14 +0100)]
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

9 months agoNormalize line endings to LF for all text files 49/1173049/3
Matthias Sohn [Fri, 24 Nov 2023 14:11:11 +0000 (15:11 +0100)]
Normalize line endings to LF for all text files

Change-Id: I69753494e4c7db4c0a8e6eca3b3e63d3ff561117

9 months agoMerge "Remove invalid spotbugs configuration"
Matthias Sohn [Fri, 22 Dec 2023 19:23:44 +0000 (19:23 +0000)]
Merge "Remove invalid spotbugs configuration"

9 months agoMerge "Fix PMD plugin configuration"
Matthias Sohn [Fri, 22 Dec 2023 19:21:33 +0000 (19:21 +0000)]
Merge "Fix PMD plugin configuration"

9 months agoBasePackFetchConnection: Skip object/ref lookups if local repo is empty 02/1173802/3
Dariusz Luksza [Mon, 18 Dec 2023 18:24:49 +0000 (18:24 +0000)]
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

9 months agoLooseObjects: Use File#exists when possible 37/1173737/2
Dariusz Luksza [Sun, 17 Dec 2023 16:43:56 +0000 (16:43 +0000)]
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

9 months agoRemove invalid spotbugs configuration 92/1173392/1
Michael Keppler [Sun, 17 Dec 2023 14:45:18 +0000 (15:45 +0100)]
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

9 months agoFix PMD plugin configuration 91/1173391/1
Michael Keppler [Sun, 17 Dec 2023 14:30:35 +0000 (15:30 +0100)]
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

10 months agoDfsReader: give subclasses visiblity over the pack bitmap index 78/1173678/5
Ivan Frade [Thu, 14 Dec 2023 17:25:06 +0000 (09:25 -0800)]
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

10 months agoPackBitmapIndex/StoredBitmap: Expose size and counts 48/205448/6
Ivan Frade [Fri, 10 Nov 2023 20:05:51 +0000 (12:05 -0800)]
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

10 months agoPackWriter/Statistics: Remove the bitmapt hit stats 03/1173603/1
Ivan Frade [Tue, 12 Dec 2023 21:31:03 +0000 (13:31 -0800)]
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

10 months agoConfigure Github issue reporting 68/1173368/1
Thomas Wolf [Sun, 10 Dec 2023 16:02:10 +0000 (17:02 +0100)]
Configure Github issue reporting

Add two forms for bug reports and feature requests.

Change-Id: I8d80f2498741ba5bb88655d1e22798f99826fb7f

10 months agoMake sure ref to prune is in packed refs 31/1173231/9
Fabio Ponciroli [Wed, 6 Dec 2023 13:38:21 +0000 (14:38 +0100)]
Make sure ref to prune is in packed refs

RefDirectory:pack might raise an NPE when deleting loose
refs as final part of the RefDirectory.pack().

This is what the code does:
1) packed ref update: update the list of refs which will be
persisted in packed-refs
2) persit packed-refs: flush on file the refs computed in #1
3) prune loose refs: prune loose refs that have been packed in #2

The code correctly locks the packed-refs file during phases 1 to 3.
However, it makes the wrong assumption of considering
the loose refs set as immutable between phases 1 and 3.

The number and values of loose refs on the filesystem can mutate
at any time whilst the RefDirectory.pack() is in progress.
Assuming the contrary can lead to an NPE when retrieving refs
from the mutable loose refs list during phase #3.

Make sure that the ref is not null before dereferencing its
object-id value.

Bug: jgit-4
Change-Id: I2cd01f8a880f3c6561ad978a389ec2db45b6018b

10 months agoMerge "API filter for PackStatistics.objectsWithBitmapsFound"
Thomas Wolf [Wed, 6 Dec 2023 08:24:45 +0000 (08:24 +0000)]
Merge "API filter for PackStatistics.objectsWithBitmapsFound"

10 months agoFooterLine: Protect from ill-formed message 47/1173047/5
Kamil Musin [Tue, 5 Dec 2023 15:22:08 +0000 (16:22 +0100)]
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

10 months agoMerge "Document option gc.writeCommitGraph"
Ivan Frade [Tue, 5 Dec 2023 18:39:19 +0000 (18:39 +0000)]
Merge "Document option gc.writeCommitGraph"

10 months agoAPI filter for PackStatistics.objectsWithBitmapsFound 76/1173176/1
Thomas Wolf [Tue, 5 Dec 2023 14:33:36 +0000 (15:33 +0100)]
API filter for PackStatistics.objectsWithBitmapsFound

The field was introduced in commit 5e563e1b.

Change-Id: Ic2f495e79319ac6044bcabf253b63b8b631eec84

10 months agoMerge "StartGenerator: Fix parent rewrite with non-default RevFilter"
Ivan Frade [Mon, 4 Dec 2023 23:38:57 +0000 (23:38 +0000)]
Merge "StartGenerator: Fix parent rewrite with non-default RevFilter"

10 months agoStartGenerator: Fix parent rewrite with non-default RevFilter 68/205168/27
Ronald Bhuleskar [Wed, 25 Oct 2023 20:10:33 +0000 (13:10 -0700)]
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

10 months agoUpdate MANIFEST.MF 42/1173142/2
Peter Kriens [Fri, 1 Dec 2023 16:47:49 +0000 (17:47 +0100)]
Update MANIFEST.MF

Add an import for javax.net.ssl

Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>
10 months agoDocument option gc.writeCommitGraph 46/1173046/1
Matthias Sohn [Mon, 4 Dec 2023 22:03:26 +0000 (23:03 +0100)]
Document option gc.writeCommitGraph

Change-Id: Ic02d5abce18250b30f2c3f3741892d8cda251001

10 months agoBump last release version to 6.8.0.202311291450-r 45/1173045/1
Matthias Sohn [Mon, 4 Dec 2023 22:11:34 +0000 (23:11 +0100)]
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

10 months agoPrepare 6.9.0-SNAPSHOT builds 44/1173044/1
Matthias Sohn [Mon, 4 Dec 2023 22:02:44 +0000 (23:02 +0100)]
Prepare 6.9.0-SNAPSHOT builds

Change-Id: Id1d784ec4870cfb53c4b140fe0bb3fad9eef651d

10 months agoMerge branch 'stable-6.8' 43/1173043/1
Matthias Sohn [Mon, 4 Dec 2023 21:58:45 +0000 (22:58 +0100)]
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

10 months agoBitmapWalkerTest: New test for the walker 71/1172471/2
Ivan Frade [Mon, 20 Nov 2023 21:18:37 +0000 (13:18 -0800)]
BitmapWalkerTest: New test for the walker

Change-Id: I414f5bdd86e5623d7669fa187df19e06acd02cef

10 months agoPackWriter: store the objects with bitmaps in the statistics 04/205504/17
Ivan Frade [Fri, 17 Nov 2023 18:44:56 +0000 (10:44 -0800)]
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

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 agoPrepare 6.8.1-SNAPSHOT builds 80/1172680/1
Matthias Sohn [Wed, 29 Nov 2023 15:53:24 +0000 (16:53 +0100)]
Prepare 6.8.1-SNAPSHOT builds

Change-Id: I56458c5345dcd9544868c948e90c9827d25c6850

10 months agoJGit v6.8.0.202311291450-r 78/1172678/1 v6.8.0.202311291450-r
Matthias Sohn [Wed, 29 Nov 2023 14:49:43 +0000 (15:49 +0100)]
JGit v6.8.0.202311291450-r

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

10 months agoRename method parameter to fix warning about hidden field 75/1172675/1
Matthias Sohn [Tue, 28 Nov 2023 23:21:31 +0000 (00:21 +0100)]
Rename method parameter to fix warning about hidden field

Change-Id: Id094ab022f82db0f3eb220052adc0aed1cde2d50

10 months agoFix warnings about empty control flow statements 74/1172674/1
Matthias Sohn [Tue, 28 Nov 2023 23:18:29 +0000 (00:18 +0100)]
Fix warnings about empty control flow statements

Change-Id: If1595ac148edf88a18efdd90c4f40d0ac719caab

10 months agoBitmapIndexImpl: externalize error message 73/1172673/1
Matthias Sohn [Tue, 28 Nov 2023 23:12:55 +0000 (00:12 +0100)]
BitmapIndexImpl: externalize error message

Change-Id: I5189e966aecc57fe7c3e6c3f7f8e6b16917ee27f

10 months agoSuppress not-externalized string warnings 72/1172672/1
Matthias Sohn [Tue, 28 Nov 2023 23:09:52 +0000 (00:09 +0100)]
Suppress not-externalized string warnings

Change-Id: I2a0a588227d451cb175e17eef20ecb6fe9e9ef80

10 months agoSilence API error for new method BitmapIndex#addBitmapLookupListener 71/1172671/1
Matthias Sohn [Tue, 28 Nov 2023 23:04:18 +0000 (00:04 +0100)]
Silence API error for new method BitmapIndex#addBitmapLookupListener

it has an empty default implementation.

Change-Id: I56b16c48992652a4ddaaf4c0435e08452c65749e

10 months agoUpdate Orbit to orbit-aggregation/2023-12 70/1172670/1
Matthias Sohn [Tue, 28 Nov 2023 22:53:29 +0000 (23:53 +0100)]
Update Orbit to orbit-aggregation/2023-12

Change-Id: Ifde28f60461e0a9d7b1278f8f178ceb2c4e1db7a

10 months agoMerge branch 'master' into stable-6.8 68/1172668/1
Matthias Sohn [Mon, 27 Nov 2023 22:34:02 +0000 (23:34 +0100)]
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

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 agoPrepare 6.8.0-SNAPSHOT builds 86/1172486/1
Matthias Sohn [Wed, 22 Nov 2023 00:41:02 +0000 (01:41 +0100)]
Prepare 6.8.0-SNAPSHOT builds

Change-Id: I89178175549541111cddb88da401899960c0ecac

10 months agoJGit v6.8.0.202311212206-rc1 83/1172483/1 v6.8.0.202311212206-rc1
Matthias Sohn [Tue, 21 Nov 2023 22:05:56 +0000 (23:05 +0100)]
JGit v6.8.0.202311212206-rc1

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

10 months agoMerge branch 'master' into stable-6.8 82/1172482/1
Matthias Sohn [Tue, 21 Nov 2023 22:04:27 +0000 (23:04 +0100)]
Merge branch 'master' into stable-6.8

* master:
  Update repository URLs in CONTRIBUTING.md
  Fix typo in FileUtils.isStaleFileHandle() javadoc
  Fix branch ref exist check
  gpg.bc: Supress errorprone InsecureCryptoUsage
  Adjust javadoc to pass errorprone checks
  Update org.apache.commons:commons-compress to 1.25.0
  Fix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD
  BitmapWalkListener: Use plain interface with noop instance
  BitmapWalkListener: Add method and rename for commits
  Update bouncycastle to 1.77
  PatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream
  BitmapWalker: announce walked objects via listener interface
  Update jetty to 10.0.18
  SSH: bump org.apache.sshd to 2.11.0
  CommitGraphWriter: Remove unnecesary progress update call

Change-Id: I97574c4801ccafd4e808a1fcf6f8d079ff5709b3

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