]> source.dussan.org Git - jgit.git/log
jgit.git
20 months agoIgnore generated org.eclipse.jgit.benchmarks/dependency-reduced-pom.xml 80/200380/1
Matthias Sohn [Tue, 7 Mar 2023 13:53:57 +0000 (14:53 +0100)]
Ignore generated org.eclipse.jgit.benchmarks/dependency-reduced-pom.xml

Change-Id: I8afe0e5128a63e0df02c5350772c942912408171

20 months ago[sshd] Fix calculation of timeout in AbstractClientProxyConnector 58/200358/4
Stephan Wahlbrink [Mon, 6 Mar 2023 09:33:24 +0000 (10:33 +0100)]
[sshd] Fix calculation of timeout in AbstractClientProxyConnector

The previous implementation mixed nano seconds (elapsed) and milli
seconds (remaining) without conversion.

Change-Id: I9e1654afa47fa32c94808af3b2dd0418a372fb00

20 months agoSilence API error raised for removed BranchRebaseMode#PRESERVE 70/200370/1
Matthias Sohn [Mon, 6 Mar 2023 20:39:42 +0000 (21:39 +0100)]
Silence API error raised for removed BranchRebaseMode#PRESERVE

It was replaced by MERGES to match C git which did that in 2.34.

Change-Id: Ib6a33b4a3650345bf0f9d3726dd9e14c5797e836

20 months agoMerge branch 'stable-6.4' into stable-6.5 20/200320/1
Matthias Sohn [Fri, 3 Mar 2023 15:03:26 +0000 (16:03 +0100)]
Merge branch 'stable-6.4' into stable-6.5

* stable-6.4:
  Improve test coverage when core.trustPackedRefsStat set to after_open

Change-Id: Id0a3b571aa6bbf159b225794ddc884f79431c670

20 months agoMerge branch 'stable-6.3' into stable-6.4 19/200319/1
Matthias Sohn [Fri, 3 Mar 2023 15:02:49 +0000 (16:02 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Improve test coverage when core.trustPackedRefsStat set to after_open

Change-Id: I236c5cbb638493cc4b23475be50d0f724d62a688

20 months agoMerge branch 'stable-6.2' into stable-6.3 18/200318/1
Matthias Sohn [Fri, 3 Mar 2023 15:02:16 +0000 (16:02 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Improve test coverage when core.trustPackedRefsStat set to after_open

Change-Id: I02d7444b28b662eb46f3d0ba1a62d342820bed1f

20 months agoMerge branch 'stable-6.1' into stable-6.2 17/200317/1
Matthias Sohn [Fri, 3 Mar 2023 15:01:26 +0000 (16:01 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Improve test coverage when core.trustPackedRefsStat set to after_open

Change-Id: I63ba388ee2e174019733e63f8177792e1808a5c3

20 months ago[errorprone] Suppress [Finally] warnings 99/200299/2
Matthias Sohn [Thu, 2 Mar 2023 09:43:10 +0000 (10:43 +0100)]
[errorprone] Suppress [Finally] warnings

In these cases we use Throwable#addSuppressed to ensure the exception
thrown in the catch block preceding the finally block throwing another
exception isn't lost.

Change-Id: I96e78a5c15238ab77ac90ca1901850ce19acfcd8

20 months agoUpdate Orbit to R20230302014618 for 2023-03 97/200297/2
Matthias Sohn [Thu, 2 Mar 2023 09:14:50 +0000 (10:14 +0100)]
Update Orbit to R20230302014618 for 2023-03

and update
- com.google.gson to 2.10.1.v20230109-0753

Change-Id: I9745797a278c43ec62a82b5620bb72f075a23c1f

20 months agoImprove test coverage when core.trustPackedRefsStat set to after_open 04/200304/1
Prudhvi Akhil Alahari [Thu, 2 Mar 2023 11:21:48 +0000 (16:51 +0530)]
Improve test coverage when core.trustPackedRefsStat set to after_open

As of today, we don't have test coverage for RefDirectory when
core.trustPackedRefsStat config is set to after_open. Thus create new
test classes which set core.trustPackedRefsStat config to after_open in
setup and extend RefDirectoryTest and FileRepositoryBuilderTest
respectively.

Change-Id: I1db6fcf414bc488106ad4c85fb934480f299c995
Signed-off-by: Prudhvi Akhil Alahari <quic_prudhvi@quicinc.com>
20 months agoPrepare 6.5.0-SNAPSHOT builds 73/200273/1
Matthias Sohn [Wed, 1 Mar 2023 14:30:29 +0000 (15:30 +0100)]
Prepare 6.5.0-SNAPSHOT builds

Change-Id: I313e3deed8fa00df0406b3d7b73e5b643dc25a05

20 months agoJGit v6.5.0.202302281825-rc1 54/200254/1 v6.5.0.202302281825-rc1
Matthias Sohn [Tue, 28 Feb 2023 23:23:58 +0000 (00:23 +0100)]
JGit v6.5.0.202302281825-rc1

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

20 months agoMerge branch 'master' into stable-6.5 51/200251/1
Matthias Sohn [Tue, 28 Feb 2023 23:11:41 +0000 (00:11 +0100)]
Merge branch 'master' into stable-6.5

* master:
  Change config pull.rebase=preserve to pull.rebase=merges
  BatchingProgressMonitor: expose time spent per task
  PackWriter: offer to write an object-size index for the pack
  Fix formatting in GC#doGc
  PackExt: Define new extension for the object size index

Change-Id: I174db870e6c2fcb72ff535b39bb6e1c3358f11b8

20 months agoPrepare 6.5.0-SNAPSHOT builds 50/200250/1
Matthias Sohn [Tue, 28 Feb 2023 23:10:18 +0000 (00:10 +0100)]
Prepare 6.5.0-SNAPSHOT builds

Change-Id: Ie95ce8fcc2a570505d23d5a1642e33c041212260

20 months agoChange config pull.rebase=preserve to pull.rebase=merges 79/199379/6
Pavel Salamon [Thu, 12 Jan 2023 15:39:07 +0000 (16:39 +0100)]
Change config pull.rebase=preserve to pull.rebase=merges

The native git option to preserve merge commits during rebase
has been changed from pull.rebase=preserve to pull.rebase=merges.

This changeset in jgit makes the same config change. The old "preserve"
option is no longer recognized and is replaced by new option called
"merges".

This makes jgit's rebase configuration compatible with native git
versions 2.34 and newer where the old "preserve" option has been
removed.

Change-Id: Ic07ff954e258115e76465a1593ef3259f4c418a3

20 months agoBatchingProgressMonitor: expose time spent per task 82/199682/7
Matthias Sohn [Thu, 19 Jan 2023 00:46:50 +0000 (01:46 +0100)]
BatchingProgressMonitor: expose time spent per task

Display elapsed time per task if enabled via
ProgressMonitor#showDuration or if system property or environment
variable GIT_TRACE_PERFORMANCE is set to "true". If both the system
property and the environment variable are set the system property takes
precedence.

E.g. using jgit CLI:

$ GIT_TRACE_PERFORMANCE=true jgit clone https://foo.bar/foobar
Cloning into 'foobar'...
remote: Counting objects: 1 [0.002s]
remote: Finding sources: 100% (15531/15531) [0.006s]
Receiving objects:      100% (169737/169737) [13.045s]
Resolving deltas:       100% (67579/67579) [1.842s]

Change-Id: I4d624e7858b286aeddbe7d4e557589986d73659e

20 months agoPackWriter: offer to write an object-size index for the pack 89/191089/25
Ivan Frade [Tue, 28 Dec 2021 22:23:40 +0000 (14:23 -0800)]
PackWriter: offer to write an object-size index for the pack

PackWriter callers tell the writer what do the want to include in the
pack and invoke #writePack(). Afterwards, they can invoke #writeIndex()
to write the corresponding pack index.

Mirror this for the object-size index, adding a #writeObjectSizeIndex()
method.

Change-Id: Ic319975c72c239cd6488303f7d4cced797e6fe00

20 months agoFix formatting in GC#doGc 65/200165/1
Matthias Sohn [Fri, 24 Feb 2023 14:18:39 +0000 (15:18 +0100)]
Fix formatting in GC#doGc

Change-Id: Ifa3adb66d4e0404bab4036d6b165d6c4dafe921a

20 months agoPackExt: Define new extension for the object size index 85/191085/19
Ivan Frade [Tue, 4 Jan 2022 20:30:10 +0000 (12:30 -0800)]
PackExt: Define new extension for the object size index

Change-Id: I6bbaf43b4e6fb456ca0e9e0c6efcfeded0f94d6d

20 months agoJGit v6.5.0.202302221508-m3 30/200130/1 v6.5.0.202302221508-m3
Matthias Sohn [Wed, 22 Feb 2023 20:09:10 +0000 (21:09 +0100)]
JGit v6.5.0.202302221508-m3

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

20 months agoMerge branch 'master' into stable-6.5 28/200128/1
Matthias Sohn [Wed, 22 Feb 2023 20:07:34 +0000 (21:07 +0100)]
Merge branch 'master' into stable-6.5

* master:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: I0a599ec9241dd3b9b9a61122b2eda6bd647bcc22

20 months agoMerge branch 'stable-6.4' 27/200127/1
Matthias Sohn [Wed, 22 Feb 2023 20:06:41 +0000 (21:06 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: Ia2797b44a60342eb9df53f0b3d674cba92a512fc

20 months agoMerge branch 'stable-6.3' into stable-6.4 25/200125/2
Matthias Sohn [Wed, 22 Feb 2023 20:04:31 +0000 (21:04 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: I5af34c92e423a651db53b4dc45ed844d5f39910d

20 months agoMerge branch 'stable-6.2' into stable-6.3 24/200124/1
Matthias Sohn [Wed, 22 Feb 2023 20:03:52 +0000 (21:03 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: I5b6b10622b61fde3f0f10455a74ae159a0b69082

20 months agoMerge branch 'stable-6.1' into stable-6.2 23/200123/1
Matthias Sohn [Wed, 22 Feb 2023 20:03:22 +0000 (21:03 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: I3ffe92566cc145053bb762f612dd96bc6d542c62

20 months agoMerge branch 'stable-6.0' into stable-6.1 22/200122/1
Matthias Sohn [Wed, 22 Feb 2023 20:02:47 +0000 (21:02 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: Idea23e555c024557d7e39a86efe25f609400b962

20 months agoMerge branch 'stable-5.13' into stable-6.0 21/200121/1
Matthias Sohn [Wed, 22 Feb 2023 20:02:09 +0000 (21:02 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  If tryLock fails to get the lock another gc has it
  Fix GcConcurrentTest#testInterruptGc
  Don't swallow IOException in GC.PidLock#lock
  Check if FileLock is valid before using or releasing it

Change-Id: I708d0936fa86b028e4da4e7e21f332f8b48ad293

20 months agoIf tryLock fails to get the lock another gc has it 19/200119/2
Matthias Sohn [Wed, 22 Feb 2023 19:36:39 +0000 (20:36 +0100)]
If tryLock fails to get the lock another gc has it

Change-Id: Ifd3bbcc5e0591883b774d23256949a83010ea134

20 months agoFix GcConcurrentTest#testInterruptGc 18/200118/2
Matthias Sohn [Wed, 22 Feb 2023 19:35:01 +0000 (20:35 +0100)]
Fix GcConcurrentTest#testInterruptGc

With the new GC.PidLock interrupting a running GC throws a
ClosedByInterruptException.

Change-Id: I7ccea1ae9a43d4edfdab2fcfd1324c64cc22b38f

20 months agoDon't swallow IOException in GC.PidLock#lock 06/200106/1
Matthias Sohn [Wed, 22 Feb 2023 18:27:30 +0000 (19:27 +0100)]
Don't swallow IOException in GC.PidLock#lock

This broke the test GcConcurrentTest#testInterruptGc which expects
ClosedByInterruptException when the thread doing gc is interrupted.

Change-Id: I89e02fc37aceeccb04c20cfc5b71cb8fa21793d6

20 months agoCheck if FileLock is valid before using or releasing it 71/200071/2
Matthias Sohn [Wed, 22 Feb 2023 01:42:32 +0000 (02:42 +0100)]
Check if FileLock is valid before using or releasing it

Change-Id: I23ba67b61b9b03772f33a929c080c0d02b8c8652

20 months agoMerge branch 'master' into stable-6.5 70/200070/1
Matthias Sohn [Wed, 22 Feb 2023 01:18:10 +0000 (02:18 +0100)]
Merge branch 'master' into stable-6.5

* master:
  Use Java 11 ProcessHandle to get pid of the current process
  UploadPack: use allow-any-sha1-in-want configuration
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: I71c8ee39e0f3438cbc1992c24f9f6c33ece88c07

20 months agoMerge branch 'stable-6.4' 68/200068/1
Matthias Sohn [Wed, 22 Feb 2023 00:29:32 +0000 (01:29 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Use Java 11 ProcessHandle to get pid of the current process
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: Ifa4e56b6ecca9305f3f1685e45450019bfc82e22

20 months agoMerge branch 'stable-6.3' into stable-6.4 67/200067/1
Matthias Sohn [Wed, 22 Feb 2023 00:28:27 +0000 (01:28 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Use Java 11 ProcessHandle to get pid of the current process
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: Ic40dbab18616d8d9fe3820b9890c86652b80eb47

20 months agoMerge branch 'stable-6.2' into stable-6.3 66/200066/1
Matthias Sohn [Wed, 22 Feb 2023 00:27:50 +0000 (01:27 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Use Java 11 ProcessHandle to get pid of the current process
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: I53cf9675deac0b588048d8224216d2a7e8bd16ec

20 months agoMerge branch 'stable-6.1' into stable-6.2 65/200065/1
Matthias Sohn [Wed, 22 Feb 2023 00:27:16 +0000 (01:27 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Use Java 11 ProcessHandle to get pid of the current process
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: I0562a4a224779ccf1e4cc1ff8f5a352e55ab220a

20 months agoMerge branch 'stable-6.0' into stable-6.1 64/200064/1
Matthias Sohn [Wed, 22 Feb 2023 00:26:36 +0000 (01:26 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Use Java 11 ProcessHandle to get pid of the current process
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: Ib9a2419253ffcbc90874adbfdb8129fee3178210

20 months agoUse Java 11 ProcessHandle to get pid of the current process 63/200063/1
Matthias Sohn [Wed, 22 Feb 2023 00:06:06 +0000 (01:06 +0100)]
Use Java 11 ProcessHandle to get pid of the current process

Change-Id: I790f218601c1d5e1b39c4101e3b2708e76b9d782

20 months agoMerge branch 'stable-5.13' into stable-6.0 62/200062/1
Matthias Sohn [Wed, 22 Feb 2023 00:00:26 +0000 (01:00 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Acquire file lock "gc.pid" before running gc
  Silence API errors introduced by 9424052f

Change-Id: Ibb5c46cb79377d2d2cd7d4586f31c86665d2851c

21 months agoUploadPack: use allow-any-sha1-in-want configuration 94/180794/8
kylezhao [Thu, 20 May 2021 03:29:59 +0000 (11:29 +0800)]
UploadPack: use allow-any-sha1-in-want configuration

C git 2.11 supports setting the equivalent of RequestPolicy.ANY with
uploadpack.allowAnySHA1InWant[1]. Parse this into TransportConfig and
use it from UploadPack.

Add additional tests for [2] and this change.

We can execute "git clone --filter=blob:none --no-checkout" successfully
with config uploadPack.allowFilter is true. But when we checkout, the
git will fetch other missing objects required by the checkout(this is
why we need this config).

When both uploadPack.allowFilter and uploadPack.allowAnySHA1InWant are
true, jgit will support partial clone. If you are using an extremely
large monorepo, this feature can help. It allows users to work on an
incomplete repo which reduces disk usage.

[1] https://github.com/git/git/commit/f8edeaa05d8623a9f6dad408237496c51101aad8
[2] change Id39771a6e42d8082099acde11249306828a053c0

Bug: 573390
Change-Id: I8fe75f03bf1fea7c11e0d67c8637bd05dd1f9b89
Signed-off-by: kylezhao <kylezhao@tencent.com>
21 months agoAcquire file lock "gc.pid" before running gc 48/199848/4
Matthias Sohn [Fri, 10 Feb 2023 22:39:20 +0000 (23:39 +0100)]
Acquire file lock "gc.pid" before running gc

Git guards gc by locking a lock file "gc.pid" before starting execution.
The lock file contains the pid and hostname of the process holding the
lock. Git tries to kill the process holding that lock if the lock file
wasn't modified in the last 12 hours and was started from the same host.

Teach JGit to acquire this lock before running gc but skip execution if
another process already holds the lock. Killing the other process could
be undesired if it's a long running application.

If the lock file wasn't modified in the last 12 hours try to lock it and
run gc if locking succeeds.

Register a shutdown hook for the lock file to ensure it is cleaned up if
the process is gracefully killed.

Change-Id: I00b838dcbf4fb0d03863bf7a2cd86b743c6c6971

21 months agoSilence API errors introduced by 9424052f 37/200037/1
Matthias Sohn [Mon, 20 Feb 2023 21:32:37 +0000 (22:32 +0100)]
Silence API errors introduced by 9424052f

Change-Id: Ia9e619a8fa06648086b583c994e4b107ae06c44d

21 months agoMerge branch 'master' into stable-6.5 33/200033/1
Matthias Sohn [Mon, 20 Feb 2023 21:18:22 +0000 (22:18 +0100)]
Merge branch 'master' into stable-6.5

* master:
  Externalize strings introduced in c9552aba
  Silence API error introduced by 596c445a
  PackConfig: add entry for minimum size to index
  Fix getPackedRefs to not throw NoSuchFileException
  PackObjectSizeIndex: interface and impl for the object-size index
  UInt24Array: Array of unsigned ints encoded in 3 bytes.
  PackIndex: expose the position of an object-id in the index
  Add pack options to preserve and prune old pack files
  DfsPackFile/DfsGC: Write commit graphs and expose in pack
  ObjectReader: Allow getCommitGraph to throw IOException
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec
  UploadPack: consume delimiter in object-info command
  PatchApplier fix - init cache with provided tree
  Avoid error-prone warning
  Fix unused exception error-prone warning
  UploadPack: advertise object-info command if enabled
  Move MemRefDatabase creation in a separate method.
  DfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats

Change-Id: Ic9f91f2139432999b99c444302457b3c08911009

21 months agoExternalize strings introduced in c9552aba 31/200031/1
Matthias Sohn [Mon, 20 Feb 2023 20:40:40 +0000 (21:40 +0100)]
Externalize strings introduced in c9552aba

Change-Id: I81bb78344df61e6eb42622fcef6235d4da0ae052

21 months agoSilence API error introduced by 596c445a 30/200030/1
Matthias Sohn [Mon, 20 Feb 2023 20:31:09 +0000 (21:31 +0100)]
Silence API error introduced by 596c445a

Change-Id: I961ba2d89c11373ccb81e6450d7d951204ffca36

21 months agoMerge branch 'stable-6.4' 29/200029/2
Matthias Sohn [Mon, 20 Feb 2023 20:26:08 +0000 (21:26 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Fix getPackedRefs to not throw NoSuchFileException
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: I36051c623fcd480aa80ed32b4e89f9bdd1b798e0

21 months agoMerge branch 'stable-6.3' into stable-6.4 27/200027/1
Matthias Sohn [Mon, 20 Feb 2023 20:01:38 +0000 (21:01 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Fix getPackedRefs to not throw NoSuchFileException
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: I1073098fb06eabafdb3c5e7fcf44d55b86a1b152

21 months agoMerge branch 'stable-6.2' into stable-6.3 26/200026/1
Matthias Sohn [Mon, 20 Feb 2023 19:59:14 +0000 (20:59 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Fix getPackedRefs to not throw NoSuchFileException
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: I765c7302ce84a6a9c28fdef29da2bfaa49477c6e

21 months agoPackConfig: add entry for minimum size to index 84/191084/18
Ivan Frade [Tue, 4 Jan 2022 19:10:04 +0000 (11:10 -0800)]
PackConfig: add entry for minimum size to index

The object size index can have up to #(blobs-in-repo) entries, taking
a relevant amount of memory. Let operators configure the threshold size
to include objects in the size index.

The index will include objects with size *at or above* this
value (with -1 for none). This is more effective for the
filter-by-size case.

Lowering the threshold adds more objects to the index. This improves
performance at the cost of memory/storage space. For the object-size
case, more calls will use the index instead of reading IO. For the
filter-by-size case, lower threshold means better granularity (if
ObjectReader#isSmallerThan is implemented based only on the index).

Change-Id: I6ccd9334adbbc2abf95fde51dbbfc85b8230ade0

21 months agoMerge branch 'stable-6.1' into stable-6.2 25/200025/1
Matthias Sohn [Thu, 16 Feb 2023 15:59:56 +0000 (16:59 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Fix getPackedRefs to not throw NoSuchFileException
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: Id32683d5f506e082d39af269803bccee0280cc27

21 months agoMerge branch 'stable-6.0' into stable-6.1 67/199967/1
Matthias Sohn [Thu, 16 Feb 2023 15:56:07 +0000 (16:56 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: I876a38c2de8b7d5eaacd00e36b85599f88173221

21 months agoMerge branch 'stable-5.13' into stable-6.0 62/199962/2
Matthias Sohn [Thu, 16 Feb 2023 15:42:58 +0000 (16:42 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Add pack options to preserve and prune old pack files
  Allow to perform PackedBatchRefUpdate without locking loose refs
  Document option "core.sha1Implementation" introduced in 59029aec

Change-Id: I423f410578f5bbe178832b80fef8998a5372182c

21 months agoFix getPackedRefs to not throw NoSuchFileException 59/199959/1
Prudhvi Akhil Alahari [Thu, 16 Feb 2023 11:11:55 +0000 (16:41 +0530)]
Fix getPackedRefs to not throw NoSuchFileException

Since Files.newInputStream is from java.nio package, it throws
java.nio.file.NoSuchFileException. This was missed in the change
I00da88e. Without this change, getPackedRefs fails with
NoSuchFileException when there is no packed-refs file in a project.

Change-Id: I93c202ddb73a0a5979af8e4d09e45f5645664b45
Signed-off-by: Prudhvi Akhil Alahari <quic_prudhvi@quicinc.com>
21 months agoPackObjectSizeIndex: interface and impl for the object-size index 83/191083/16
Ivan Frade [Wed, 15 Dec 2021 00:36:54 +0000 (16:36 -0800)]
PackObjectSizeIndex: interface and impl for the object-size index

Operations like "clone --filter=blob:limit=N" or the "object-info"
command need to read the size of the objects from the storage. An
index would provide those sizes at once rather than having to seek in
the packfile.

Introduce an interface for the Object-size index. This index returns
the inflated size of an object. Not all objects could be indexed (to
limit memory usage).

This implementation indexes only blobs (no trees, nor
commits) *above* certain size threshold (configurable). Lower
threshold adds more objects to the index, consumes more memory and
provides better performance. 0 means "all blobs" and -1 "disabled".

If we don't index everything, for the filter use case is more
efficient to index the biggest objects first: the set is small and
most objects are filtered by NOT being in the index. For the
object-size, the more objects in the index the better, regardless
their size. All together, it is more helpful to index above threshold.

Change-Id: I9ed608ac240677e199b90ca40d420bcad9231489

21 months agoUInt24Array: Array of unsigned ints encoded in 3 bytes. 92/199892/3
Ivan Frade [Fri, 10 Feb 2023 20:21:01 +0000 (12:21 -0800)]
UInt24Array: Array of unsigned ints encoded in 3 bytes.

The object size index stores positions of objects in the main
index (when ordered by sha1). These positions are per-pack and usually
a pack has <16 million objects (there are exceptions but rather
rare). It could save some memory storing these positions in three bytes
instead of four. Note that these positions are sorted and always positive.

Implement a wrapper around a byte[] to access and search "ints" while
they are stored as unsigned 3 bytes.

Change-Id: Iaa26ce8e2272e706e35fe4cdb648fb6ca7591972

21 months agoPackIndex: expose the position of an object-id in the index 67/199467/5
Ivan Frade [Tue, 17 Jan 2023 18:01:29 +0000 (10:01 -0800)]
PackIndex: expose the position of an object-id in the index

The primary index returns the offset in the pack for an
objectId. Internally it keeps the object-ids in lexicographical order,
but doesn't expose an API to find the position of an object-id in that
list. This is needed for the object-size index, that we want to store
as "position-in-idx, size".

Add a #findPosition(object-id) method to the PackIndex interface to
know where an object-id sits in the ordered list of ids in the pack.

Note that this index position is over the list of ordered object-ids,
while reverse-index position is over the list of objects in packed
order.

Change-Id: I89fa146599e347a26d3012d3477d7f5bbbda7ba4

21 months agoAdd pack options to preserve and prune old pack files 46/199846/2
Matthias Sohn [Fri, 10 Feb 2023 20:05:47 +0000 (21:05 +0100)]
Add pack options to preserve and prune old pack files

Add the options
- pack.preserveOldPacks
- pack.prunePreserved

This allows to configure in git config if old packs should be preserved
during gc and pruned during the next gc.

The original implementation in 91132bb0 only allows to set these options
using the API.

Change-Id: I5b23ab4f317d12f5ccd234401419913e8263cc9a

21 months agoDfsPackFile/DfsGC: Write commit graphs and expose in pack 54/199654/11
Xing Huang [Mon, 6 Feb 2023 20:18:59 +0000 (14:18 -0600)]
DfsPackFile/DfsGC: Write commit graphs and expose in pack

JGit knows how to read/write commit graphs but the DFS stack is not
using it yet.

The DFS garbage collector generates a commit-graph with commits
reachable from any ref. The pack is stored as extra stream in the GC
pack. DfsPackFile mimicks how other indices are loaded storing the
reference in DFS cache.

Signed-off-by: Xing Huang <xingkhuang@google.com>
Change-Id: I3f94997377986d21a56b300d8358dd27be37f5de

21 months agoObjectReader: Allow getCommitGraph to throw IOException 85/199785/4
Xing Huang [Mon, 6 Feb 2023 20:18:16 +0000 (14:18 -0600)]
ObjectReader: Allow getCommitGraph to throw IOException

ObjectReader#getCommitGraph doesn't report errors loading the
commit graph. The caller should be aware of the situation and
ultimately decide what to do.

Add IOException to ObjectReader#getCommitGraph signature. RevWalk
defaults to an empty commit-graph on IO errors.

Signed-off-by: Xing Huang <xingkhuang@google.com>
Change-Id: I38eeacff76c7f926b6dfb192d1e5916e40770024

21 months agoAllow to perform PackedBatchRefUpdate without locking loose refs 58/199758/1
Saša Živkov [Fri, 21 Oct 2022 14:32:03 +0000 (16:32 +0200)]
Allow to perform PackedBatchRefUpdate without locking loose refs

Add another newBatchUpdate method in the RefDirectory where we can
control if the created PackedBatchRefUpdate will lock the loose refs or
not.

This can be useful in cases when we run programs which have exclusive
access to a Git repository and we know that locking loose refs is
unnecessary and just a performance loss.

Change-Id: I7d0932eb1598a3871a2281b1a049021380234df9
(cherry picked from commit cb90ed08526bd51f04e5d72e3ba3cf5bd30c11e4)

21 months agoMerge "Merge branch 'stable-6.5'"
Matthias Sohn [Thu, 2 Feb 2023 20:20:14 +0000 (15:20 -0500)]
Merge "Merge branch 'stable-6.5'"

21 months agoDocument option "core.sha1Implementation" introduced in 59029aec 11/199711/2
Matthias Sohn [Wed, 1 Feb 2023 13:33:31 +0000 (14:33 +0100)]
Document option "core.sha1Implementation" introduced in 59029aec

Bug: 580310
Change-Id: I10f3d6f6b5af7ab96683994c9cbd85e6c18a5084

21 months agoMerge "UploadPack: consume delimiter in object-info command"
Han-Wen NIenhuys [Thu, 2 Feb 2023 14:09:25 +0000 (09:09 -0500)]
Merge "UploadPack: consume delimiter in object-info command"

21 months agoMerge "PatchApplier fix - init cache with provided tree"
Han-Wen NIenhuys [Thu, 2 Feb 2023 14:00:56 +0000 (09:00 -0500)]
Merge "PatchApplier fix - init cache with provided tree"

21 months agoUploadPack: consume delimiter in object-info command 98/199698/7
Han-Wen Nienhuys [Tue, 31 Jan 2023 22:27:27 +0000 (23:27 +0100)]
UploadPack: consume delimiter in object-info command

The 'size' packet line is an argument, so it
must be preceeded by a 0001 delimiter. See also git's
t5701-git-serve.sh test,

https://github.com/git/git/blob/8b8d9a2/t/t5701-git-serve.sh#L329

Without this fix, the server will choke on the delimiter line, saying
PackProtocolException: unexpected <empty string>

To test, I ran Gerrit locally with this fix

$ curl -X POST   -H 'git-protocol: version=2'   -H 'content-type:
application/x-git-upload-pack-request'   -H 'accept:
application/x-git-upload-pack-result'   --data
$'0018command=object-info\n00010009size\n0031oid
d38b1b92bdb2893eb4505667375563f2d6d4086b\n0000'
http://localhost:8080/git.git/git-upload-pack

=>

0008size0032d38b1b92bdb2893eb4505667375563f2d6d4086b 268590000

The same command completes identically on Gitlab (which supports the
object-info command)

$ curl -X POST   -H 'git-protocol: version=2'   -H 'content-type:
application/x-git-upload-pack-request'   -H 'accept:
application/x-git-upload-pack-result'   --data
$'0018command=object-info\n00010009size\n0031oid
d38b1b92bdb2893eb4505667375563f2d6d4086b\n0000'
https://gitlab.com/gitlab-org/git.git/git-upload-pack

=>

0008size0032d38b1b92bdb2893eb4505667375563f2d6d4086b 268590000

In this case, the blob is for the COPYING file in the Git source tree,
which is 26859 bytes long.

Change-Id: Ief4ce1eb9303a3b2479547d7950ef01c7c28f472

21 months agoPatchApplier fix - init cache with provided tree 06/199706/4
Nitzan Gur-Furman [Tue, 31 Jan 2023 21:01:21 +0000 (22:01 +0100)]
PatchApplier fix - init cache with provided tree

This change only affects inCore repositories.
Before this change, any file that wasn't part of the patch
wasn't read, and therefore wasn't part of the output tree.

Change-Id: I246ef957088f17aaf367143f7a0b3af0f8264ffb
Bug: Google b/267270348

21 months agoMerge "DfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats"
Ivan Frade [Wed, 1 Feb 2023 23:06:56 +0000 (18:06 -0500)]
Merge "DfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats"

21 months agoMerge branch 'stable-6.5' 38/199738/1
Matthias Sohn [Wed, 1 Feb 2023 22:25:43 +0000 (23:25 +0100)]
Merge branch 'stable-6.5'

* stable-6.5:
  Prepare 6.5.0-SNAPSHOT builds
  JGit v6.5.0.202302011120-m2

Change-Id: I2629d0e07d25690e6de179a42e2d7e3321791f8f

21 months agoPrepare 6.5.0-SNAPSHOT builds 36/199736/1
Matthias Sohn [Wed, 1 Feb 2023 22:23:08 +0000 (23:23 +0100)]
Prepare 6.5.0-SNAPSHOT builds

Change-Id: Id0c7e51293d53b1eeec081cbbdf6e27d77123200

21 months agoMerge changes I343cc3cf,I9dedf61b
Matthias Sohn [Wed, 1 Feb 2023 21:52:37 +0000 (16:52 -0500)]
Merge changes I343cc3cf,I9dedf61b

* changes:
  Avoid error-prone warning
  Fix unused exception error-prone warning

21 months agoJGit v6.5.0.202302011120-m2 18/199718/1 v6.5.0.202302011120-m2
Matthias Sohn [Wed, 1 Feb 2023 16:22:23 +0000 (17:22 +0100)]
JGit v6.5.0.202302011120-m2

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

21 months agoAvoid error-prone warning 02/199702/1
Han-Wen Nienhuys [Tue, 31 Jan 2023 22:23:44 +0000 (23:23 +0100)]
Avoid error-prone warning

GC.gc() returns a Future, which should not be discarded. See also
https://errorprone.info/bugpattern/FutureReturnValueIgnored

Change-Id: I343cc3cfe74a564ad7f8d53f0fe9d96a23aaed00

21 months agoFix unused exception error-prone warning 01/199701/1
Han-Wen Nienhuys [Tue, 31 Jan 2023 22:24:30 +0000 (23:24 +0100)]
Fix unused exception error-prone warning

Ignoring the exception seems intended in this case.

Change-Id: I9dedf61b9cb5a6ff39fb141dd5da19143f4f6978

21 months agoUploadPack: advertise object-info command if enabled 99/199699/1
Han-Wen Nienhuys [Tue, 31 Jan 2023 22:25:19 +0000 (23:25 +0100)]
UploadPack: advertise object-info command if enabled

Change-Id: Iad8e5b5f4fdd84bd275eb19ee0d01eb6986d79f2

21 months agoMerge "Move MemRefDatabase creation in a separate method."
Han-Wen NIenhuys [Wed, 1 Feb 2023 09:15:44 +0000 (04:15 -0500)]
Merge "Move MemRefDatabase creation in a separate method."

21 months agoMerge branch 'master' into stable-6.5 89/199689/1
Matthias Sohn [Wed, 1 Feb 2023 00:31:32 +0000 (01:31 +0100)]
Merge branch 'master' into stable-6.5

* master:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  [pgm] Fetch-CLI: add support for shallow
  Speedup GC listing objects referenced from reflogs
  Re-add servlet-api 4.0 to the target platform
  Upgrade maven plugins
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: I370bc228481864912c3cd88d43e5a70517b1c186

21 months agoMerge branch 'stable-6.4' 88/199688/1
Matthias Sohn [Wed, 1 Feb 2023 00:21:11 +0000 (01:21 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Id0ebfbd85eb815716383b9495eb7dd1f54cf4d74

21 months agoMerge branch 'stable-6.3' into stable-6.4 87/199687/1
Matthias Sohn [Wed, 1 Feb 2023 00:12:06 +0000 (01:12 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Iefcf5d832bd0087c1027876f2200689e1150abce

21 months agoMerge branch 'stable-6.2' into stable-6.3 86/199686/1
Matthias Sohn [Tue, 31 Jan 2023 23:59:32 +0000 (00:59 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: I2ff386d9a096277360e6c7bd5535b49984620fb3

21 months agoMerge branch 'stable-6.1' into stable-6.2 85/199685/1
Matthias Sohn [Tue, 31 Jan 2023 23:44:41 +0000 (00:44 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Iff2fba026b49463016015b2fae1a42cf76ee2dbb

21 months agoMerge branch 'stable-6.0' into stable-6.1 84/199684/1
Matthias Sohn [Tue, 31 Jan 2023 23:38:52 +0000 (00:38 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Ib5055f2f3b8a313c178d6f6c7c5630285ad5a726

21 months agoMerge branch 'stable-5.13' into stable-6.0 83/199683/1
Matthias Sohn [Tue, 31 Jan 2023 23:30:52 +0000 (00:30 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: I58ad4c210a5e7e5a1ba6b22315b04211c8909950

21 months agoShortcut during git fetch for avoiding looping through all local refs 64/193464/12
Luca Milanesio [Wed, 18 May 2022 12:31:30 +0000 (13:31 +0100)]
Shortcut during git fetch for avoiding looping through all local refs

The FetchProcess needs to verify that all the refs received point
to objects that are reachable from the local refs, which could be
very expensive but is needed to avoid missing objects exceptions
because of broken chains.

When the local repository has a lot of refs (e.g. millions) and the
client is fetching a non-commit object (e.g. refs/sequences/changes in
Gerrit) the reachability check on all local refs can be very expensive
compared to the time to fetch the remote ref.

Example for a 2M refs repository:
- fetching a single non-commit object: 50ms
- checking the reachability of local refs: 30s

A ref pointing to a non-commit object doesn't have any parent or
successor objects, hence would never need to have a reachability check
done. Skipping the askForIsComplete() altogether would save the 30s
time spent in an unnecessary phase.

Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Change-Id: I09ac66ded45cede199ba30f9e71cc1055f00941b

21 months agoFetchCommand: fix fetchSubmodules to work on a Ref to a blob 23/196223/2
Matthias Sohn [Tue, 4 Oct 2022 13:42:25 +0000 (15:42 +0200)]
FetchCommand: fix fetchSubmodules to work on a Ref to a blob

FetchCommand#fetchSubmodules assumed that FETCH_HEAD can always be
parsed as a tree. This isn't true if it refers to a Ref referring to a
BLOB. This is e.g. used in Gerrit for Refs like refs/sequences/changes
which are used to implement sequences stored in git.

Change-Id: I414f5b7d9f2184b2d7d53af1dfcd68cccb725ca4

21 months agoSilence API warnings introduced by I466dcde6 80/199680/1
Matthias Sohn [Tue, 31 Jan 2023 22:45:07 +0000 (23:45 +0100)]
Silence API warnings introduced by I466dcde6

Change-Id: I510510da34d33757c2f83af8cd1e26f6206a486a

21 months agoAllow the exclusions of refs prefixes from bitmap 76/197776/28
Luca Milanesio [Tue, 20 Dec 2022 21:50:19 +0000 (21:50 +0000)]
Allow the exclusions of refs prefixes from bitmap

When running a GC.repack() against a repository with over one
thousands of refs/heads and tens of millions of ObjectIds,
the calculation of all bitmaps associated with all the refs
would result in an unreasonable big file that would take up to
several hours to compute.

Test scenario: repo with 2500 heads / 10M obj Intel Xeon E5-2680 2.5GHz
Before this change: 20 mins
After this change and 2300 heads excluded: 10 mins (90s for bitmap)

Having such a large bitmap file is also slow in the runtime
processing and have negligible or even negative benefits, because
the time lost in reading and decompressing the bitmap in memory
would not be compensated by the time saved by using it.

It is key to preserve the bitmaps for those refs that are mostly
used in clone/fetch and give the ability to exlude some refs
prefixes that are known to be less frequently accessed, even
though they may actually be actively written.

Example: Gerrit sandbox branches may even be actively
used and selected automatically because its commits are very
recent, however, they may bloat the bitmap, making it ineffective.

A mono-repo with tens of thousands of developers may have
a relatively small number of active branches where the
CI/CD jobs are continuously fetching/cloning the code. However,
because Gerrit allows the use of sandbox branches, the
total number of refs/heads may be even tens to hundred
thousands.

Change-Id: I466dcde69fa008e7f7785735c977f6e150e3b644
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
21 months agoMove MemRefDatabase creation in a separate method. 16/197816/5
Dmitrii Filippov [Tue, 31 Jan 2023 18:31:59 +0000 (13:31 -0500)]
Move MemRefDatabase creation in a separate method.

The InMemoryRepository is used in tests (e.g. in gerrit tests) and it
can be useful to create a custom MemRefDatabase for some tests.

Change-Id: I6fbbbfe04400ea1edc988c8788c8eeb06ca8480a

21 months agoPackWriterBitmapPreparer: do not include annotated tags in bitmap 51/197851/16
Luca Milanesio [Wed, 28 Dec 2022 01:09:52 +0000 (01:09 +0000)]
PackWriterBitmapPreparer: do not include annotated tags in bitmap

The annotated tags should be excluded from the bitmap associated
with the heads-only packfile. However, this was not happening
because of the check of exclusion of the peeled object instead
of the objectId to be excluded from the bitmap.

Sample use-case:

refs/heads/main
  ^
  |
 commit1 <-- commit2 <- annotated-tag1 <- tag1
  ^
  |
 commit0

When creating a bitmap for the above commit graph, before this
change all the commits are included (3 bitmaps), which is
incorrect, because all commits reachable from annotated tags
should not be included.

The heads-only bitmap should include only commit0 and commit1
but because PackWriterBitPreparer was checking for the peeled
pointer of tag1 to be excluded (commit2) which was not found in
the list of tags to exclude (annotated-tag1), the commit2 was
included, even if it wasn't reachable only from the head.

Add an additional check for exclusion of the original objectId
for allowing the exclusion of annotated tags and their pointed
commits. Add one specific test associated with an annotated tag
for making sure that this use-case is covered also.

Example repository benchmark for measuring the improvement:
# refs: 400k (2k heads, 88k tags, 310k changes)
# objects: 11M (88k of them are annotate tags)
# packfiles: 2.7G

Before this change:
GC time: 5h
clone --bare time: 7 mins

After this change:
GC time: 20 mins
clone --bare time: 3 mins

Bug: 581267
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Change-Id: Iff2bfc6587153001837220189a120ead9ac649dc

21 months agoBatchingProgressMonitor: avoid int overflow when computing percentage 35/199435/4
Matthias Sohn [Mon, 16 Jan 2023 20:58:56 +0000 (21:58 +0100)]
BatchingProgressMonitor: avoid int overflow when computing percentage

When cloning huge repositories I observed percentage of object counts
turning negative. This happened if lastWork * 100 exceeded
Integer.MAX_VALUE.

Change-Id: Ic5f5cf5a911a91338267aace4daba4b873ab3900

21 months agoDfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats 46/199546/4
Xing Huang [Tue, 24 Jan 2023 19:17:40 +0000 (13:17 -0600)]
DfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats

We are adding commit-graph loading to the DFS stack and the stats object doesn't have fields to track that.

This change replicates the stats of the primary index for the commit-graph.

Signed-off-by: Xing Huang <xingkhuang@google.com>
Change-Id: I4a657bed50083c4ae8bc9f059d4943d612ea2d49

21 months ago[pgm] Fetch-CLI: add support for shallow 77/196477/2
Harald Weiner [Mon, 24 Oct 2022 21:07:27 +0000 (23:07 +0200)]
[pgm] Fetch-CLI: add support for shallow

This adds support for shallow cloning. The CloneCommand and the
FetchCommand now have the new options --depth, --shallow-since and
--shallow-exclude to tell the server that the client doesn't want to
download the complete history.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615
Change-Id: I8f113bed25dd6df64f2f95de6a59d4675ab8a903

21 months agoSpeedup GC listing objects referenced from reflogs 68/199468/3
Matthias Sohn [Wed, 18 Jan 2023 16:39:19 +0000 (17:39 +0100)]
Speedup GC listing objects referenced from reflogs

GC needs to get a ReflogReader for all existing refs to list all objects
referenced from reflogs. The existing Repository#getReflogReader method
accepts the ref name and then resolves the Ref to create a ReflogReader.
GC calling that for a huge number of Refs one by one is very slow. GC
first gets all Refs in bulk and then calls getReflogReader for each of
them.

Fix this by adding another getReflogReader method to Repository which
accepts a Ref directly.

This speeds up running JGit gc on a mirror clone of the Gerrit
repository from 15:36 min to 1:08 min. The repository used in this test
had 45k refs, 275k commits and 1.2m git objects.

Change-Id: I474897fdc6652923e35d461c065a29f54d9949f4

22 months agoRe-add servlet-api 4.0 to the target platform 34/199434/1
Matthias Sohn [Mon, 16 Jan 2023 13:27:32 +0000 (14:27 +0100)]
Re-add servlet-api 4.0 to the target platform

This was removed from the JGit target platform by mistake in 6ca3d219.

Change-Id: Iedae0586fb96651255b67ed6dbb9ff7702c0ea54

22 months agoUpgrade maven plugins 68/199268/2
Michael Keppler [Fri, 6 Jan 2023 17:33:00 +0000 (18:33 +0100)]
Upgrade maven plugins

Remove tycho-extras-version, because Tycho and Tycho Extras are
meanwhile in a single repository and maintained together.

Update
- build-helper-maven-plugin to 3.3.0
- eclipse-jarsigner-plugin to 1.3.5
- jacoco-maven-plugin to 0.8.8
- japicmp to 0.17.1
- maven-antrun-plugin to 3.1.0
- maven-clean-plugin to 3.2.0
- maven-compiler-plugin to 3.10.1
- maven-dependency-plugin to 3.5.0
- maven-deploy-plugin to 3.0.0
- maven-enforcer-plugin to 3.1.0
- maven-install-plugin to 3.1.0
- maven-jar-plugin to 3.3.0
- maven-javadoc-plugin to 3.4.1
- maven-jxr-plugin to 3.3.0
- maven-pmd-plugin to 3.20.0
- maven-project-info-reports-plugin to 3.4.2
- maven-resources-plugin to 3.3.0
- maven-shade-plugin to 3.4.1
- maven-site-plugin to 4.0.0-M4
- maven-surefire-plugin to 3.0.0-M8
- spotbugs-maven-plugin to 4.7.3.0
- spring-boot-maven-plugin to 2.7.7

Change-Id: I14d9ff06d2f509d782eb63adfa6b5733649f11f1

22 months agoMerge branch 'stable-6.5' 06/199406/1
Matthias Sohn [Fri, 13 Jan 2023 18:34:43 +0000 (19:34 +0100)]
Merge branch 'stable-6.5'

* stable-6.5:
  Prepare 6.5.0-SNAPSHOT builds
  JGit v6.5.0.202301111425-m1

Change-Id: Ic37f47cb1a7d975918ee9d416576ea9e30aa62db

22 months agoMerge branch 'stable-6.4' 05/199405/1
Matthias Sohn [Fri, 13 Jan 2023 18:33:54 +0000 (19:33 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: Iea8038dfde29ab988501469f86ee829e578a2fe8

22 months agoMerge branch 'stable-6.3' into stable-6.4 04/199404/1
Matthias Sohn [Fri, 13 Jan 2023 18:32:56 +0000 (19:32 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: I1db2b51ae8101f345d08235d4f3dc416bfcb42d5

22 months agoMerge branch 'stable-6.2' into stable-6.3 03/199403/1
Matthias Sohn [Fri, 13 Jan 2023 18:32:06 +0000 (19:32 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: Ibc9bffab8c9ef9c39384b53c142d99878f7f3f98

22 months agoMerge branch 'stable-6.1' into stable-6.2 02/199402/1
Matthias Sohn [Fri, 13 Jan 2023 18:31:18 +0000 (19:31 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: I9e876f72f735f58bf02c7862a3d8e657fc46a7b9

22 months agoCache trustFolderStat/trustPackedRefsStat value per-instance 25/199325/3
Nasser Grainawi [Tue, 10 Jan 2023 23:15:42 +0000 (16:15 -0700)]
Cache trustFolderStat/trustPackedRefsStat value per-instance

Instead of re-reading the config every time the methods using these
values were called, cache the config value at the time of instance
construction. Caching the values improves performance for each of the
method calls. These configs are set based on the filesystem storing the
repository and unlikely to change while an application is running.

Change-Id: I1cae26dad672dd28b766ac532a871671475652df
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>