]> source.dussan.org Git - jgit.git/log
jgit.git
7 weeks agoMerge branch 'stable-6.6' into stable-6.7 81/1201681/1 stable-6.7
Matthias Sohn [Thu, 26 Sep 2024 21:36:12 +0000 (23:36 +0200)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  AdvertisedRequestValidator: fix WantNotValidException caused by race

Change-Id: I5b7b097a4b57ec48a3ee20fc25cb0d080cc1af80

8 weeks agoAdvertisedRequestValidator: fix WantNotValidException caused by race 80/1201680/3 stable-6.6
Matthias Sohn [Tue, 24 Sep 2024 08:51:22 +0000 (10:51 +0200)]
AdvertisedRequestValidator: fix WantNotValidException caused by race

Fetch with protocol V2 failed under the following conditions
- fetch uses bidirectional protocol (git, ssh) which uses a shortcut
  to determine invalid wants
- not all wants are advertised
- race condition: wanted ref is updated during fetch by another thread
  after the thread serving upload-pack determined wants and before it
  checks not advertised wants

Fix this by calling
`new ReachableCommitRequestValidator().checkWants(up, wants)`
instead of throwing WantNotValidException in [1]
if this race happened in the same way like it's done for unidirectional
protocols (http) [2].

[1] https://github.com/eclipse-jgit/jgit/blob/stable-6.10/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java#L2002
[2] https://github.com/eclipse-jgit/jgit/blob/stable-6.10/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java#L2000

Bug: jgit-48
Change-Id: I32f28502923815dc49781aab5d810c9afbe7e7e6

3 months agoMerge branch 'stable-6.6' into stable-6.7 61/1199461/3
Matthias Sohn [Tue, 20 Aug 2024 12:54:08 +0000 (14:54 +0200)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Update tycho to 4.0.8
  Update org.eclipse.dash:license-tool-plugin to 1.1.0
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: I79bb467325e5c09d93e0220be8233ba0d91562cb

3 months agoMerge branch 'stable-6.5' into stable-6.6 60/1199460/3
Matthias Sohn [Tue, 20 Aug 2024 12:28:33 +0000 (14:28 +0200)]
Merge branch 'stable-6.5' into stable-6.6

* stable-6.5:
  Update org.eclipse.dash:license-tool-plugin to 1.1.0
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: I54d1776b3ea096d458b8005e70c02e7edef71c2b

3 months agoUpdate tycho to 4.0.8 67/1199467/1
Matthias Sohn [Tue, 20 Aug 2024 12:25:31 +0000 (14:25 +0200)]
Update tycho to 4.0.8

Change-Id: I0d6b99c07734bed166a16d7ce489c34286f29c82

3 months agoMerge branch 'stable-6.4' into stable-6.5 59/1199459/2 stable-6.5
Matthias Sohn [Sun, 18 Aug 2024 16:35:29 +0000 (18:35 +0200)]
Merge branch 'stable-6.4' into stable-6.5

* stable-6.4:
  Update org.eclipse.dash:license-tool-plugin to 1.1.0
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: Ieae366586ac4c449a4f9454dc4b63513e7573776

3 months agoMerge branch 'stable-6.3' into stable-6.4 58/1199458/2 stable-6.4
Matthias Sohn [Sun, 18 Aug 2024 16:33:59 +0000 (18:33 +0200)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: Ia9eefc4004ca01d97ff0c4dae9a6220d48e76b88

3 months agoUpdate org.eclipse.dash:license-tool-plugin to 1.1.0 66/1199466/1
Matthias Sohn [Wed, 14 Aug 2024 21:17:13 +0000 (23:17 +0200)]
Update org.eclipse.dash:license-tool-plugin to 1.1.0

Change-Id: Idb5c74f75110edc35e8a89de52aca8392acb297f

3 months agoMerge branch 'stable-6.2' into stable-6.3 57/1199457/1 stable-6.3
Matthias Sohn [Wed, 14 Aug 2024 08:51:16 +0000 (10:51 +0200)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: I6bce3a4d64a617d74d0cbf4e79887b067e1ea2c5

3 months agoMerge branch 'stable-6.1' into stable-6.2 56/1199456/1 stable-6.2
Matthias Sohn [Wed, 14 Aug 2024 07:25:43 +0000 (09:25 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: Ib536297ef20a75b36cff8f41d57855913f7d7f26

3 months agoMerge branch 'stable-6.0' into stable-6.1 55/1199455/1 stable-6.1
Matthias Sohn [Wed, 14 Aug 2024 07:24:40 +0000 (09:24 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: I23afe07585ff17ad8486cbe2c667f6acbe912542

3 months agoMerge branch 'stable-5.13' into stable-6.0 54/1199454/1 stable-6.0
Matthias Sohn [Wed, 14 Aug 2024 06:57:35 +0000 (08:57 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Fix "Comparison of narrow type with wide type in loop condition"
  JGit v5.13.3.202401111512-r

Change-Id: Ib15aa83972d81986959889dc03e943fe55c78873

3 months agoFix "Comparison of narrow type with wide type in loop condition" 67/1198667/1 stable-5.13
Matthias Sohn [Fri, 9 Aug 2024 09:53:01 +0000 (11:53 +0200)]
Fix "Comparison of narrow type with wide type in loop condition"

This issue was detected by a GitHub CodeQL security scan run on JGit
source code.

Description of the error raised by the security scan:
"In a loop condition, comparison of a value of a narrow type with a
value of a wide type may always evaluate to true if the wider value is
sufficiently large (or small). This is because the narrower value may
overflow. This can lead to an infinite loop."

Fix this by using type `long` for the local variable `done`.

Change-Id: Ibd4f71299e3f2e40d4331227bd143569a4264d8c

8 months agoMerge branch 'stable-6.6' into stable-6.7
Matthias Sohn [Wed, 21 Feb 2024 16:41:44 +0000 (17:41 +0100)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Delete org.eclipse.jgit.ssh.apache.agent/bin/.project
  Allow to discover bitmap on disk created after the packfile

Change-Id: I2bbc8c9a4ed45d37fa7ba63b2afd5511b6cf47a2

9 months agoDelete org.eclipse.jgit.ssh.apache.agent/bin/.project 91/1177191/1
Matthias Sohn [Wed, 21 Feb 2024 15:43:43 +0000 (16:43 +0100)]
Delete org.eclipse.jgit.ssh.apache.agent/bin/.project

Change-Id: If2f50f81ffb8b5a1929b0ce403bff017ece29e2f

9 months agoAllow to discover bitmap on disk created after the packfile 96/1174396/15
Luca Milanesio [Wed, 10 Jan 2024 19:38:46 +0000 (19:38 +0000)]
Allow to discover bitmap on disk created after the packfile

When the bitmap file was created *after* a packfile had been
loaded into the memory, JGit was unable to discover them.

That happed because of two problems:

1. The PackDirectory.getPacks() does not implement the usual
   while loop that is scanning through the packs directory
   as in the other parts of JGit.

2. The scan packs does not look for newly created bitmap files
   if the packfile is already loaded in memory.

Implement the normal packfiles scanning whenever the PackDirectory
needs to return a list of packs, and make sure that any reused
Pack object would have its associated bitmap properly refreshed
from disk.

Adapt the assertions in GcConcurrentTest with the rescanned list
of Pack from the objects/packs directory.

Bug: jgit-15
Change-Id: I2ed576cefd78a0e128b175228a59c9af51523d7b

9 months agoMerge branch 'stable-6.6' into stable-6.7 27/1176927/1
Dariusz Luksza [Thu, 15 Feb 2024 10:36:41 +0000 (10:36 +0000)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  RefDirectory: Do not unlock until after deleting loose ref
  Add missing javadoc description for declared exception
  SnapshottingRefDirectory: Invalidate snapshot after locking ref for update
  SnapshottingRefDir: Replace lambas with method refs
  SnapshottingRefDir: Reduce casts with overrides

Change-Id: Ic5f3c46e5557d0bd143694bd6020b67b6ec8f22e

9 months agoRefDirectory: Do not unlock until after deleting loose ref 74/1176274/3
Nasser Grainawi [Fri, 26 Jan 2024 01:59:15 +0000 (18:59 -0700)]
RefDirectory: Do not unlock until after deleting loose ref

Fix a potential race condition where we would remove our loose ref lock
file before deleting the loose ref itself. This race could result in the
current thread deleting a loose ref newly written by another thread.

Other callers seem to be following the correct pattern, but improve the
method naming to try to help future callers.

Change-Id: I80cebe4788edd855e15381336d980c41498fca80
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
9 months agoAdd missing javadoc description for declared exception 31/1176831/1
Matthias Sohn [Tue, 13 Feb 2024 14:49:54 +0000 (15:49 +0100)]
Add missing javadoc description for declared exception

Change-Id: I16305bc15d2ddff1ce055772a711658ef81858e2

9 months agoSnapshottingRefDirectory: Invalidate snapshot after locking ref for 75/1176275/4
Nasser Grainawi [Thu, 25 Jan 2024 23:29:05 +0000 (16:29 -0700)]
SnapshottingRefDirectory: Invalidate snapshot after locking ref for
update

When using the SnapshottingRefDirectory, if a thread has already read
packed-refs, then another actor updates packed-refs, the original
thread may create an update that is based on the old cached/snapshotted
packed-refs content. That update could effectively perform a forced
update unintentionally because it is unaware of the new content.

This seems particularly likely to happen in a scenario where a loose
ref was just packed. If the ref was loose, our thread would see the
current ref value (because we don't snapshot loose refs and always read
them from disk), but since there is no loose ref, we expect to find the
current value in packed-refs. However, (before this change) we rely
on our snapshot of packed-refs which does not contain the updated ref
value.

Invalidating the cache after the loose ref is locked ensures that the
ref value does not change again before we read it to perform the update.

Bug: jgit-21
Change-Id: Id10900a99bfd0401a1b9c39d997093af0289649e
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
9 months agoSnapshottingRefDir: Replace lambas with method refs 89/1176789/2
Nasser Grainawi [Mon, 12 Feb 2024 23:32:30 +0000 (16:32 -0700)]
SnapshottingRefDir: Replace lambas with method refs

Method references are shorter and easier to read in this case.

Change-Id: Ia6809fa0e3f282acbe7b7f7e3813a34f3cf40c43
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
9 months agoSnapshottingRefDir: Reduce casts with overrides 88/1176788/2
Nasser Grainawi [Mon, 12 Feb 2024 23:29:47 +0000 (16:29 -0700)]
SnapshottingRefDir: Reduce casts with overrides

Overriding getRefDirectory() and getRefDatabase() lets us skip casting
to SnapshottingRefDirectory in several places.

Change-Id: I61ba12fb6f066b1a9c4ea5ec9538978cbf040acd
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
9 months ago[errorprone] Fix wrong comparison which always evaluated to false 58/1176058/1
Matthias Sohn [Fri, 15 Sep 2023 09:48:05 +0000 (11:48 +0200)]
[errorprone] Fix wrong comparison which always evaluated to false

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java:59:
error: [ComparisonOutOfRange] ints may have a value in the range
-2147483648 to 2147483647; therefore, this comparison to
Integer.MAX_VALUE will always evaluate to false
if (table[k] > Integer.MAX_VALUE) {
             ^

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

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

This was introduced in Ib5c0d6678cb242870a0f5841bd413ad3885e95f6

Change-Id: I675d594f523084be4c1678328cc343065e32d998
(cherry picked from commit 916200e278ebeaa2602b5dc23143c8eedf11858b)

9 months ago[errorprone] Remove unnecessary comparison 57/1176057/1
Matthias Sohn [Fri, 15 Sep 2023 09:44:09 +0000 (11:44 +0200)]
[errorprone] Remove unnecessary comparison

Raised by errorprone:

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

Change-Id: I9625aa7894a34dbffd77d39a40c6e285c86b56d5
(cherry picked from commit cf5ec856bda907c0537ce5a80246b9ab18195c8b)

9 months agoMerge branch 'stable-6.6' into stable-6.7 46/1176746/1
Dariusz Luksza [Mon, 12 Feb 2024 09:56:36 +0000 (09:56 +0000)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Improve handling of NFS stale handle errors
  Fix handling of missing pack index file
  Add tests for handling pack files removal during fetch

Change-Id: Ie00984319d68beeffcbdb6bb323fbeb94a118e5c

9 months agoImprove handling of NFS stale handle errors 25/1176125/1
Dariusz Luksza [Mon, 20 Nov 2023 11:53:19 +0000 (11:53 +0000)]
Improve handling of NFS stale handle errors

Mark packfile as invalid when NFS stale handle error occurs.

This should fix broken fetch operations when the repo is located on the
NFS system and is GC'ed on a separate system (or process). Which may
result in the index, pack or bitmap file being removed when they are
accessed from the fetch operation.

Bug: 573770
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
Change-Id: I70217bfb93bf7421ea2c1d74cbe4f15c76d9c098
(cherry picked from commit c701c01b49d92993f1c3df0a0e26a2dd68b8cec1)

9 months agoFix handling of missing pack index file 24/1176124/1
Dariusz Luksza [Mon, 20 Nov 2023 11:00:51 +0000 (11:00 +0000)]
Fix handling of missing pack index file

As demonstrated in
`UploadPackHandleDeletedPackFile.testV2IdxFileRemovedDuringUploadPack`
the fetch operation will fail when the pack index file is removed.

This is due to a wrapping of `FileNotFoundException` (which is a
subclass of `IOExeption`) in an `IOException` at PackIndex L#68. This
is then changing the behaviour of error handling in
`Pack.file.getBitmapIndex()` where the `FileNotFoundException` is
swallowed and allows the fetch process to continue. With FNFE being
wrapped in IOE, this blows up and breaks the fetch operation.

Simply rethrowing `FileNotFoundException` from `PackFile.open()` fixes
the broken fetch operation. This will also mark the whole pack as
invalid in the `IOException` handler in `Pack.idx()` method.

Change-Id: Ibe321aa1af21d26500e1cb2eb3464cc99a6dbc62
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
(cherry picked from commit e0910eda3ea1c474b4cf9b00ac698f739a982f8c)

9 months agoAdd tests for handling pack files removal during fetch 23/1176123/1
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>
(cherry picked from commit ba5adc4ce6f234cb300b0f73a1efdba9bba1b5d8)

10 months agoMerge branch 'stable-6.6' into stable-6.7 05/1174605/1
Matthias Sohn [Fri, 19 Jan 2024 23:18:25 +0000 (00:18 +0100)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Introduce a PriorityQueue sorting RevCommits by commit timestamp
  Remove org.eclipse.jgit.benchmark/.factorypath
  Update jmh to 1.37 for org.eclipse.jgit.benchmark

Change-Id: I76ebca527e523f124bfe81c821169c790eddccb6

10 months agoIntroduce a PriorityQueue sorting RevCommits by commit timestamp 40/194140/36
Luca Milanesio [Mon, 13 Jun 2022 22:09:55 +0000 (23:09 +0100)]
Introduce a PriorityQueue sorting RevCommits by commit timestamp

The DateRevQueue uses a tailor-made algorithm to keep
RevCommits sorted by reversed commit timestamp, which has a O(n*n/2)
complexity and caused the explosion of the Git fetch times to
tens of seconds.

The standard Java PriorityQueue provides a O(n*log(n)) complexity
and scales much better with the increase of the number of
RevCommits.

Introduce a new implementation DateRevPriorityQueue of the DateRevQueue
based on PriorityQueue.

Enable usage of the new DateRevPriorityQueue implementation by setting
the system property REVWALK_USE_PRIORITY_QUEUE=true. By default the old
implementation DateRevQueue is used.

Benchmark results:
```
(numCommits)  (usePriorityQueue)  Mode  Cnt     Score Error  Units
           5                true  avgt   10    39,4 ±   6,1  ns/op
           5               false  avgt   10    14,1 ±   2,2  ns/op
          10                true  avgt   10    29,7 ±   3,5  ns/op
          10               false  avgt   10    13,2 ±   2,0  ns/op
          50                true  avgt   10    50,4 ±   5,3  ns/op
          50               false  avgt   10    18,6 ±   0,2  ns/op
         100                true  avgt   10    58,3 ±   5,0  ns/op
         100               false  avgt   10    20,5 ±   0,8  ns/op
         500                true  avgt   10    51,7 ±   2,6  ns/op
         500               false  avgt   10    43,3 ±   0,5  ns/op
        1000                true  avgt   10    49,2 ±   2,4  ns/op
        1000               false  avgt   10    62,7 ±   0,2  ns/op
        5000                true  avgt   10    48,8 ±   1,5  ns/op
        5000               false  avgt   10   228,3 ±   0,5  ns/op
       10000                true  avgt   10    44,2 ±   0,9  ns/op
       10000               false  avgt   10   377,6 ±   2,7  ns/op
       50000                true  avgt   10    50,3 ±   1,6  ns/op
       50000               false  avgt   10   637,0 ± 111,8  ns/op
      100000                true  avgt   10    61,8 ±   4,4  ns/op
      100000               false  avgt   10   965,1 ± 268,0  ns/op
      500000                true  avgt   10   127,2 ±   7,9  ns/op
      500000               false  avgt   10  9610,2 ± 184,8  ns/op
```

Memory allocation results:
```
Number of commits loaded: 850 000
Custom implementation: 378 245 120 Bytes
Priority queue implementation: 340 495 616 Bytes
```

Bug: 580137
Change-Id: I8b33df6e9ee88933098ecc81ce32bdb189715041
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
10 months agoRemove org.eclipse.jgit.benchmark/.factorypath 04/1174604/1
Matthias Sohn [Fri, 19 Jan 2024 00:27:07 +0000 (01:27 +0100)]
Remove org.eclipse.jgit.benchmark/.factorypath

it's outdated and seems to be unused.

Change-Id: I4ac0f6d6427ee9f76a59296e991e4e03b25bcf05

10 months agoUpdate jmh to 1.37 for org.eclipse.jgit.benchmark 03/1174603/2
Matthias Sohn [Thu, 18 Jan 2024 12:35:01 +0000 (13:35 +0100)]
Update jmh to 1.37 for org.eclipse.jgit.benchmark

and
- fix org.eclipse.jgit.benchmark/.classpath

Change-Id: I66f81228f17ede5732fa43aa693b4cfddb5a71f6

10 months agoJGit v5.13.3.202401111512-r 13/1174313/1 v5.13.3.202401111512-r
Matthias Sohn [Thu, 11 Jan 2024 14:12:40 +0000 (15:12 +0100)]
JGit v5.13.3.202401111512-r

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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

11 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

13 months agoCheckout: better directory handling 42/204642/6
Thomas Wolf [Fri, 11 Aug 2023 19:40:13 +0000 (21:40 +0200)]
Checkout: better directory handling

This backports the upstream security fix to downstream stable-5.13 branch.
(cherry picked from commit 9072103f3b3cf64dd12ad2949836ab98f62dabf1)

When checking out a file into the working tree ensure that all parent
directories of the file below the working tree root are actually
directories and do exist before we try to create the file.

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

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

Change-Id: Ie12864c54c9f901a2ccee7caddec73027f353111
Signed-off-by: Thomas Wolf <twolf@apache.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

14 months agoPrepare 6.7.1-SNAPSHOT builds 44/204144/1
Matthias Sohn [Wed, 6 Sep 2023 20:45:52 +0000 (22:45 +0200)]
Prepare 6.7.1-SNAPSHOT builds

Change-Id: I96097ef8c6f198220f513bbc6d5f8881834a1491

14 months agoSwitch back to wagon-ssh-external 42/204142/1
Matthias Sohn [Wed, 6 Sep 2023 23:07:04 +0000 (01:07 +0200)]
Switch back to wagon-ssh-external

Bug: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/2818
Change-Id: Ic283e5229b1a8a0b1ae349555ac7cfb7b046d7be

14 months agoFix generation of maven site 41/204141/1
Matthias Sohn [Wed, 6 Sep 2023 22:06:52 +0000 (00:06 +0200)]
Fix generation of maven site

- update maven-site-plugin to 4.0.0-M9
- use wagon-ssh extension for deployment
- disable doclint
- don't fail the build for javadoc warnings

Change-Id: I81f7229deaf6892416ce4cebd6c122f00a857d51

14 months agoJGit v6.7.0.202309050840-r 83/204083/1 v6.7.0.202309050840-r
Matthias Sohn [Tue, 5 Sep 2023 12:41:09 +0000 (14:41 +0200)]
JGit v6.7.0.202309050840-r

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

14 months agoRemove unused API problem filters 80/204080/1
Matthias Sohn [Tue, 5 Sep 2023 12:10:30 +0000 (14:10 +0200)]
Remove unused API problem filters

Change-Id: If37ac92711cef94a835cfd303997a3d129d212ac

14 months ago[releng] Bump japicmp base version to 6.6.0.202305301015-r 95/204095/2
Thomas Wolf [Mon, 4 Sep 2023 19:37:42 +0000 (21:37 +0200)]
[releng] Bump japicmp base version to 6.6.0.202305301015-r

Change-Id: I5392537713d4909d4fc2fee6e2b21502e0674b43
Signed-off-by: Thomas Wolf <twolf@apache.org>
14 months agoFix list of 3rd party bundles in p2 repo 73/204073/1
Matthias Sohn [Mon, 4 Sep 2023 14:59:52 +0000 (16:59 +0200)]
Fix list of 3rd party bundles in p2 repo

The jgit p2 repo should contain all 3rd party dependencies needed at
runtime but not dependencies only used in tests.

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

Change-Id: Ie789cb8feab0905e7e23aae1d5378e82a0088992

14 months agoAdd missing source bundle org.osgi.service.cm.source to target platform 72/204072/1
Matthias Sohn [Mon, 4 Sep 2023 14:57:24 +0000 (16:57 +0200)]
Add missing source bundle org.osgi.service.cm.source to target platform

Change-Id: I6e61278467ad11d28c08ee6b49e04dac0593f3e6

14 months agoMerge branch 'stable-6.6' into stable-6.7 45/204045/1
Matthias Sohn [Sun, 3 Sep 2023 00:16:04 +0000 (02:16 +0200)]
Merge branch 'stable-6.6' into stable-6.7

* stable-6.6:
  Prepare 6.6.2-SNAPSHOT builds
  JGit v6.6.1.202309021850-r
  Checkout: better directory handling

Change-Id: Ice82d68b2d343a5fac214807cdb369e486481aab

14 months agoPrepare 6.6.2-SNAPSHOT builds 44/204044/1
Matthias Sohn [Sat, 2 Sep 2023 23:57:43 +0000 (01:57 +0200)]
Prepare 6.6.2-SNAPSHOT builds

Change-Id: Id4e2fbefc49115c7e3de26a34cfbe01ba6de25b2

14 months agoJGit v6.6.1.202309021850-r 43/204043/1 v6.6.1.202309021850-r
Matthias Sohn [Sat, 2 Sep 2023 22:50:37 +0000 (00:50 +0200)]
JGit v6.6.1.202309021850-r

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

14 months agoCheckout: better directory handling 42/204042/1
Thomas Wolf [Fri, 11 Aug 2023 19:40:13 +0000 (21:40 +0200)]
Checkout: better directory handling

When checking out a file into the working tree ensure that all parent
directories of the file below the working tree root are actually
directories and do exist before we try to create the file.

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

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

Change-Id: Ie12864c54c9f901a2ccee7caddec73027f353111
Signed-off-by: Thomas Wolf <twolf@apache.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 months agoMerge branch 'master' into stable-6.7 39/204039/1
Matthias Sohn [Sat, 2 Sep 2023 07:40:19 +0000 (09:40 +0200)]
Merge branch 'master' into stable-6.7

* master:
  CommitGraphWriter: throw exception on unknown chunk

Change-Id: Iaa0c563917c4195fccd57f5e6839a37008c9b808

14 months agoCommitGraphWriter: throw exception on unknown chunk 61/204061/2
Ivan Frade [Fri, 1 Sep 2023 18:25:50 +0000 (11:25 -0700)]
CommitGraphWriter: throw exception on unknown chunk

CommitGraphWriter first defines the chunks and then writes them. If at
write time a chunk is unknown, it is ignored. This is brittle: if
somebody adds a chunk to the header but not to the actual writing, the
commit-graph is broken and there is no error reported anywhere.

Throw exception if at write time a chunk is unknown. This can only
happen by a coding error in the writer.

Change-Id: Iade677bb6ce368b6941b75a21c622917afa3b751

14 months agoDocument commit-graph options supported by JGit 34/204034/1
Matthias Sohn [Fri, 1 Sep 2023 08:43:21 +0000 (10:43 +0200)]
Document commit-graph options supported by JGit

Change-Id: I0ab1b826232bbfcf28518d7a01ae5c5d82a08e04

14 months agoFix warning raised for local variable hiding DfsPackFile#index 03/204003/1
Matthias Sohn [Thu, 31 Aug 2023 13:13:34 +0000 (15:13 +0200)]
Fix warning raised for local variable hiding DfsPackFile#index

Change-Id: I45cd3be942f798d51af1e024ceb3f4d26c7af324

14 months agoSuppress boxing warnings in DfsPackFile 02/204002/1
Matthias Sohn [Thu, 31 Aug 2023 13:11:50 +0000 (15:11 +0200)]
Suppress boxing warnings in DfsPackFile

Change-Id: I4b5a0a7ffdeaf7d7839787aa8b98ea9c72f70850

14 months agoRemove unused API problem filters 01/204001/1
Matthias Sohn [Thu, 31 Aug 2023 12:46:38 +0000 (14:46 +0200)]
Remove unused API problem filters

Change-Id: I96b73a948794ab5aaadaa558ae75b512f54d64fe

14 months agoSuppress boxing warnings in tests 00/204000/1
Matthias Sohn [Thu, 31 Aug 2023 12:45:36 +0000 (14:45 +0200)]
Suppress boxing warnings in tests

Change-Id: I56731862b0955286f86b1c0699d75313eb192fdf

14 months agoFix warning about empty block 99/203999/1
Matthias Sohn [Thu, 31 Aug 2023 12:43:28 +0000 (14:43 +0200)]
Fix warning about empty block

Change-Id: I569fb9bf39e851bca451e5a35539589766ba5c05

14 months agoUpdate mockito to 5.5.0 98/203998/1
Matthias Sohn [Thu, 31 Aug 2023 10:08:36 +0000 (12:08 +0200)]
Update mockito to 5.5.0

Change-Id: Ic62864aaf15388b8f20b2db8aa65d1dcf03465a6

14 months agoUpdate byte-buddy to 1.14.7 97/203997/1
Matthias Sohn [Thu, 31 Aug 2023 08:37:23 +0000 (10:37 +0200)]
Update byte-buddy to 1.14.7

Change-Id: Iee257eef4cdc3235db6172e19d8d271ff9988fa4

14 months agoPrepare 6.7.0-SNAPSHOT builds 66/203966/1
Matthias Sohn [Wed, 30 Aug 2023 15:46:26 +0000 (17:46 +0200)]
Prepare 6.7.0-SNAPSHOT builds

Change-Id: I49751232464e70b7d1dc3292a9f36b7a7015e44f

14 months agoJGit v6.7.0.202308301100-rc1 64/203964/1 v6.7.0.202308301100-rc1
Matthias Sohn [Wed, 30 Aug 2023 14:57:25 +0000 (16:57 +0200)]
JGit v6.7.0.202308301100-rc1

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

14 months agoMerge branch 'master' into stable-6.7 63/203963/1
Matthias Sohn [Wed, 30 Aug 2023 14:43:08 +0000 (16:43 +0200)]
Merge branch 'master' into stable-6.7

* master:
  Remove the cbi-snapshots Maven repository
  Update Orbit to orbit-aggregation/release/4.29.0
  Add target platform for Eclipse 2023-09 (4.29)
  Use release p2 repo for Eclipse 2023-06 (4.28)
  Update tycho to 4.0.2
  Update jmh to 1.37
  Update bouncycastle to 1.76
  Fix some tests in ConfigTest
  Handle global git config $XDG_CONFIG_HOME/git/config
  IO: use JDK convenience methods
  org.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags
  ReadChangedPathFilter: fix Non-externalized string literal warning
  Introduce core.packedIndexGitUseStrongRefs config key
  DfsReader: Make PackLoadListener interface visible to subclasses
  DfsGarbageCollector: provide commit graph stats
  DfsGarbageCollector: put only GC commits into the commit graph
  DfsReader: Expose when indices are loaded

Change-Id: Idd78a0a1bc3cd3db5edb475e235c13354d9087a9

14 months agoRemove the cbi-snapshots Maven repository 58/203958/2
Matthias Sohn [Wed, 30 Aug 2023 12:15:27 +0000 (14:15 +0200)]
Remove the cbi-snapshots Maven repository

since it's not used anymore.

Change-Id: I884c5e5854d6a1f5b104d8d3bb0419e860fa34ca

14 months agoUpdate Orbit to orbit-aggregation/release/4.29.0 54/203954/5
Matthias Sohn [Tue, 29 Aug 2023 22:36:29 +0000 (00:36 +0200)]
Update Orbit to orbit-aggregation/release/4.29.0

Switch to bundle dependencies for hamcrest 1.3 to avoid issues with
split packages in that version.

Don't allow hamcrest 2.x yet since junit 4.13.2 still requires hamcrest
1.3.

See Orbit restructuring in
https://github.com/orgs/eclipse-orbit/discussions/49

Change-Id: I8faf519b8f2c4e4a6bd255d694d1aa28017acd85

14 months agoAdd target platform for Eclipse 2023-09 (4.29) 53/203953/2
Matthias Sohn [Tue, 29 Aug 2023 22:12:16 +0000 (00:12 +0200)]
Add target platform for Eclipse 2023-09 (4.29)

Change-Id: I62f9bacebf0a2a2cba6ffde7936572e3f05a629c

14 months agoUse release p2 repo for Eclipse 2023-06 (4.28) 52/203952/1
Matthias Sohn [Tue, 29 Aug 2023 22:11:54 +0000 (00:11 +0200)]
Use release p2 repo for Eclipse 2023-06 (4.28)

Change-Id: I3b8794bdb43db12c2eacda1de27651686c41abf5

14 months agoUpdate tycho to 4.0.2 88/203888/1
Matthias Sohn [Tue, 29 Aug 2023 21:22:57 +0000 (23:22 +0200)]
Update tycho to 4.0.2

Change-Id: Ib619bc09bf79c0f9e7526c0303606f314e8c1209

14 months agoUpdate jmh to 1.37 87/203887/1
Matthias Sohn [Tue, 29 Aug 2023 21:17:50 +0000 (23:17 +0200)]
Update jmh to 1.37

Change-Id: I39e3dda1c13268c44055295398eab36c5ff7eb3e

14 months agoUpdate bouncycastle to 1.76 84/203884/2
Matthias Sohn [Tue, 29 Aug 2023 20:01:03 +0000 (22:01 +0200)]
Update bouncycastle to 1.76

Change-Id: Ic569f348106e917001fbaa25a302fc20cca56244

14 months agoFix some tests in ConfigTest 82/203882/1
Matthias Sohn [Tue, 29 Aug 2023 19:26:34 +0000 (21:26 +0200)]
Fix some tests in ConfigTest

Some of the ConfigTest tests created a FileRepositoryBuilder but didn't
use it to actually create a FileRepository.

Change-Id: I1a4b27891daee1b235a71e7bbf2a7588b9d11a53

14 months agoHandle global git config $XDG_CONFIG_HOME/git/config 48/203248/3
Thomas Wolf [Wed, 5 Jul 2023 20:21:30 +0000 (22:21 +0200)]
Handle global git config $XDG_CONFIG_HOME/git/config

C git uses this alternate fallback location if the file exists and
~/.gitconfig does not. Implement this also for JGit.

If both files exist, reading behavior is as if the XDG config was
inserted between the HOME config and the system config. Writing
behaviour is different: all changes will be applied only in the HOME
config. Updates will occur in the XDG config only if the HOME config
does not exist.

This is consistent with the behavior of C git; compare [1], especially
the sections on FILES and SCOPES, and the description of the --global
option.

[1] https://git-scm.com/docs/git-config

Bug: 581875
Change-Id: I2460b9aa963fd2811ed8a5b77b05107d916f2b44
Signed-off-by: Thomas Wolf <twolf@apache.org>
14 months agoIO: use JDK convenience methods 02/203702/2
Jörg Kubitz [Thu, 17 Aug 2023 09:20:13 +0000 (11:20 +0200)]
IO: use JDK convenience methods

The benefit is that certain InputStreams can override the default
implementation for performance reasons.

Change-Id: I4c924157ec0f0ec63b0eca7cdbdc9325af24cab6

14 months agoorg.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags 97/203697/3
Jörg Kubitz [Wed, 16 Aug 2023 12:51:35 +0000 (14:51 +0200)]
org.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags

error was introduced with I0fb77bb9b498d48d5da88a93486b99bf8121e3bd

Change-Id: I60af78cf0213a07356cb39b5f756679c58daee56

14 months agoReadChangedPathFilter: fix Non-externalized string literal warning 96/203696/3
Jörg Kubitz [Wed, 16 Aug 2023 12:39:23 +0000 (14:39 +0200)]
ReadChangedPathFilter: fix Non-externalized string literal warning

Change-Id: I78161a2dbc08918267bc59a1ed267c5108f5c391

14 months agoIntroduce core.packedIndexGitUseStrongRefs config key 06/203706/7
Martin Fick [Tue, 15 Aug 2023 03:48:55 +0000 (21:48 -0600)]
Introduce core.packedIndexGitUseStrongRefs config key

Introduce a core.packedIndexGitUseStrongRefs configuration key, which
defaults to true so that the current behavior does not change. However,
setting it to false allows soft references to be used for Pack indices
instead of strong references so that they can be garbage collected when
there is memory pressure.

Pack objects can be large when associated with pack files with large
object counts, and this memory is not really accounted for or tracked by
the WindowCache and it can be very substantial at times, especially with
many large object count projects. A particularly problematic use case is
Gerrit's ls-projects command which loads very little data in the
WindowCache via ByteWindows, but ends up loading and holding many entire
indices in memory, sometimes even after the ByteWindows for their Pack
objects have already been garbage collected since they won't get cleared
until after a new ByteWindow is loaded. By using SoftReferences, single
use indices can get cleared when there is memory pressure and OOMs can
be easily avoided, drastically reducing the amount of memory required to
perform an ls-projects on large sites with many projects and large
object counts.

On one of our test sites, an ls-projects command with strong index
references requires more than 66GB of heap to complete successfully,
with soft index references it requires less than 23GB.

Change-Id: I3cb3df52f4ce1b8c554d378807218f199077d80b
Signed-off-by: Martin Fick <quic_mfick@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
15 months agoMerge "DfsGarbageCollector: provide commit graph stats"
Jonathan Tan [Mon, 21 Aug 2023 17:07:51 +0000 (13:07 -0400)]
Merge "DfsGarbageCollector: provide commit graph stats"

15 months agoDfsReader: Make PackLoadListener interface visible to subclasses 20/203720/2
Ivan Frade [Fri, 18 Aug 2023 18:22:35 +0000 (11:22 -0700)]
DfsReader: Make PackLoadListener interface visible to subclasses

A subclass cannot implement a listener with the default access.

Make the interface protected. Not public because so far only
subclasses are interested in this interface. We can widen the
visibility later if needed.

Change-Id: I54e5c0ef1312dfe2fa660bc8fb54e2be35c0f6df

15 months agoDfsGarbageCollector: provide commit graph stats 14/203714/1
Jonathan Tan [Thu, 17 Aug 2023 22:41:02 +0000 (15:41 -0700)]
DfsGarbageCollector: provide commit graph stats

Provide commit graph stats in the same way that we provide reftable
stats.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Change-Id: Ib80c892a26f9b552bc90f3cbe7da83b02ffebdfd

15 months agoDfsGarbageCollector: put only GC commits into the commit graph 86/203686/2
Ivan Frade [Wed, 16 Aug 2023 20:26:39 +0000 (13:26 -0700)]
DfsGarbageCollector: put only GC commits into the commit graph

GC puts all commits reachable from heads and tags into the GC pack,
and commits reachable only from other refs (e.g. refs/changes) into
GC_REST. The commit-graph contains all commits in GC and GC_REST. This
produces too big commit graphs in some repos, beating the purpose of
loading the index.

Limit the commit graph to commits reachable from heads and tags
(i.e. commits in the GC pack).

Change-Id: I4962faea5a726d2ea3e548af0aeae370a6cc8588

15 months agoDfsReader: Expose when indices are loaded 99/203399/11
Ivan Frade [Fri, 28 Jul 2023 09:41:26 +0000 (11:41 +0200)]
DfsReader: Expose when indices are loaded

We want to measure the data used to serve a request. As a first step,
we want to know how many indices are accessed during the request and
their sizes.

Expose an interface in DfsReader to announce when an index is loaded
into the reader, i.e. when its reference is set.

The interface is more flexible to implementors (what/how to collect)
than the existing DfsReaderIOStats object.

Change-Id: I56f7658fde1758efaf869fa779d11b533a81a0a7

15 months agoMerge branch 'stable-6.7' 27/203527/2
Matthias Sohn [Thu, 3 Aug 2023 08:19:05 +0000 (10:19 +0200)]
Merge branch 'stable-6.7'

* stable-6.7:
  Update to Tycho 4.0.1
  Prepare 6.7.0-SNAPSHOT builds
  JGit v6.7.0.202308011830-m2
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I197d6116a4b5badc58b57d309982d2f6b3e45825