]> source.dussan.org Git - jgit.git/log
jgit.git
6 months agoMerge "PackBitmapIndex: hide packChecksum behind getter"
Ivan Frade [Wed, 20 Mar 2024 22:49:43 +0000 (22:49 +0000)]
Merge "PackBitmapIndex: hide packChecksum behind getter"

6 months agoMerge "Cache refreshed loose ref dirs in SnapshottingRefDirectory"
Matthias Sohn [Wed, 20 Mar 2024 07:20:25 +0000 (07:20 +0000)]
Merge "Cache refreshed loose ref dirs in SnapshottingRefDirectory"

6 months agoMerge "TreeRevFilter: correct changedPathFilter usage for multi-paths inclusion"
jonathantanmy [Tue, 19 Mar 2024 22:13:36 +0000 (22:13 +0000)]
Merge "TreeRevFilter: correct changedPathFilter usage for multi-paths inclusion"

6 months agoCache refreshed loose ref dirs in SnapshottingRefDirectory 41/205141/6
Nasser Grainawi [Fri, 23 Feb 2024 17:34:37 +0000 (09:34 -0800)]
Cache refreshed loose ref dirs in SnapshottingRefDirectory

Update SnapshottingRefDirectory to have a cache of dirs refreshed for
loose refs. This should help improve performance when 'after_open'
setting is used for 'trustLooseRefStat' as duplicate refreshes are
avoided when a snapshot of the ref database is used in a request scope.

Change-Id: I8f66e7cee572e477d29abe2d9db69e97bca3ee4c
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
Co-authored-by: Martin Fick <quic_mfick@quicinc.com>
Co-authored-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
6 months agoPackBitmapIndex: hide packChecksum behind getter 14/1184614/1
Sam Delmerico [Tue, 19 Mar 2024 00:14:24 +0000 (17:14 -0700)]
PackBitmapIndex: hide packChecksum behind getter

This allows more flexibility in overriding the PackBitmapIndex and also
allows us to turn PackBitmapIndex into an interface in
https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1178201.

Change-Id: I3be611fad67ff38b308c0052a04149f1497858ae

6 months agoMerge "CleanupService: preload JgitText if not running in OSGi"
Thomas Wolf [Mon, 18 Mar 2024 19:49:37 +0000 (19:49 +0000)]
Merge "CleanupService: preload JgitText if not running in OSGi"

6 months agoTreeRevFilter: correct changedPathFilter usage for multi-paths inclusion 82/1177882/16
Xing Huang [Thu, 7 Mar 2024 17:41:36 +0000 (11:41 -0600)]
TreeRevFilter: correct changedPathFilter usage for multi-paths inclusion

The expected behavior of TreeRevFilter when filtering multiple file
paths is to include commits that changed at least one of the given
paths; only skipping them if they did not change any of the given
paths. The current changedPathFilter utilization logic is skipping a
commit if there exists at least one given path that the commit did not
change, disregarding the rest of the given paths.

Enforcing all given paths to be checked by the changedPathFilter, only
skipping a commit if changedPathFilter return negative on all given
paths.

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

6 months agoPathFilterGroup: implement getPathsBestEffort() 17/1184117/2
Xing Huang [Fri, 15 Mar 2024 20:19:15 +0000 (15:19 -0500)]
PathFilterGroup: implement getPathsBestEffort()

getPathsBestEffort() is a method in the TreeFilter class
to retrieve file paths specified by the caller. PathFilterGroup do not
propagate the paths of their subfilters as it does not implement the
getPathsBestEffort() method, resulting in the caller only getting an
empty list of paths.

Override getPathsBestEffort() in PathFilterGroup to propagate subfilter
values.

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

7 months agoCleanupService: preload JgitText if not running in OSGi 44/1183644/1
Thomas Wolf [Sun, 10 Mar 2024 18:37:51 +0000 (19:37 +0100)]
CleanupService: preload JgitText if not running in OSGi

Load class JGitText eagerly when ShutdownHook is used. If not running
in an OSGi framework, the hook executes as a JVM shutdown hook. Normally
classloading in a shutdown hook should not be a problem, but there are
some other frameworks besides OSGi that may close classloaders before
such a JVM shutdown hook runs, for instance Plexus classworlds used in
maven.

This is not a full fix for classloading problems in JGit shutdown hooks.
If a listener causes additional classes to be loaded, there may still
be problems. But the current listeners registered with ShutdownHook all
appear to use only classes that should already be loaded; except
JGitText.

Bug: jgit-36
Change-Id: Iab00134b4720adb19e1394c38ad79f1c43c3466b
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months agoDfsPackFile: get commitGraph.readChangePaths from repo config 98/1178198/8
Xing Huang [Tue, 12 Mar 2024 21:32:46 +0000 (16:32 -0500)]
DfsPackFile: get commitGraph.readChangePaths from repo config

By default, CommitGraphLoader reads the readChangedPaths flag from
SystemReader ignoring the values set at repo-level.

Read the value of the property from the repo configuration and pass it
to CommitGraphLoader.

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

7 months agoMerge "CommitGraphLoader: receive readChangedPaths as parameter"
Ivan Frade [Tue, 12 Mar 2024 23:07:32 +0000 (23:07 +0000)]
Merge "CommitGraphLoader: receive readChangedPaths as parameter"

7 months agoCommitGraphLoader: receive readChangedPaths as parameter 97/1178197/3
Xing Huang [Tue, 12 Mar 2024 21:24:10 +0000 (16:24 -0500)]
CommitGraphLoader: receive readChangedPaths as parameter

commitGraph.readChangedPaths controls the read of bloom filter
chunks from commit graph. CommitGraphLoader uses SystemReader
to read this conf, so it only sees its value when it is set in
$XDG_CONFIG_HOME/jgit/config (and not, for example, in the repo
config).

Pass the readChangedPaths value to the method that reads the commit
graph. Callers should read the value from the right configuration.

This change is a noop, but allows to move callers to the new method
progressively. Follow up changes will remove the previous method and
its usages.

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

7 months agoMerge "Add pull request template discouraging usage of pull requests"
Matthias Sohn [Mon, 11 Mar 2024 22:00:59 +0000 (22:00 +0000)]
Merge "Add pull request template discouraging usage of pull requests"

7 months agoAdd pull request template discouraging usage of pull requests 75/1177775/1
Matthias Sohn [Mon, 11 Mar 2024 14:04:27 +0000 (15:04 +0100)]
Add pull request template discouraging usage of pull requests

since we use Gerrit for code review.

Change-Id: I2eeea82452d678564e17e3db9bd6ca7ef4ae4cc2

7 months agoUpdate CONTRIBUTING.md to point to GitHub issues 77/1177977/1
Antonin Delpeuch [Sun, 10 Mar 2024 20:41:33 +0000 (21:41 +0100)]
Update CONTRIBUTING.md to point to GitHub issues

With a link to older bugs in Bugzilla.
I have no idea if this is an accurate description of the situation,
it's all guesswork on my part.

Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu>
Change-Id: I019689115a744daf588a86b44e998d2dfe03d4b5

7 months agoMerge "ShutdownHook: run on bundle deactivation if in OSGi"
Matthias Sohn [Sat, 9 Mar 2024 23:49:14 +0000 (23:49 +0000)]
Merge "ShutdownHook: run on bundle deactivation if in OSGi"

7 months agoFS_POSIX.runInShell(): on MacOS use a login shell 12/1177212/3
Thomas Wolf [Wed, 21 Feb 2024 21:52:45 +0000 (22:52 +0100)]
FS_POSIX.runInShell(): on MacOS use a login shell

On Mac, $PATH for UI programs is not the same as in a shell (terminal).
It is typically much shorter. This may lead to surprises when hooks that
work fine via the command-line git do not work when run via JGit in a UI
application, such as EGit in Eclipse.

Therefore use a login shell to run hooks and other commands spawned by
git if we're on MacOS. This will give the hooks the same environment as
in a terminal.

Bug: egit-16
Change-Id: Id2e5485c6d3080d3ef8baa61ad7f6f198f77c590
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months ago[ssh] Implement the "Ciphers" SSH config 11/1177211/2
Thomas Wolf [Sat, 3 Feb 2024 21:22:16 +0000 (22:22 +0100)]
[ssh] Implement the "Ciphers" SSH config

Upstream will remove the CBC algorithms aes128-cbc, aes192-cbc, and
aes256-cbc from the server's KEX proposal in the next release. Removal
of these algorithms by default in the client is planned for the release
after that. These CBC algorithms were found vulnerable back in 2008,[1]
and OpenSSH does not propose them: server-side since 2014, client-side
since 2017.

It is _highly_ unlikely that the removal of these algorithms by default
would affect any JGit user. Nevertheless, let's give users a way to
explicitly specify ciphers (including enabling deprecated algorithms)
via their ~/.ssh/config file.

[1] https://www.kb.cert.org/vuls/id/958563

Change-Id: I7444861df3a7f526277fef2485773a20ac74ae8a
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months agoShutdownHook: run on bundle deactivation if in OSGi 51/1177951/1
Thomas Wolf [Fri, 8 Mar 2024 18:48:27 +0000 (19:48 +0100)]
ShutdownHook: run on bundle deactivation if in OSGi

Running as a JVM shutdown hook is far too late in an OSGi framework; by
the time the JVM shuts down, the OSGi framework will normally already
have deactivated and unloaded bundles, and thus the JGit cleanup code
may try to work with unloaded classes for which there will be no
classloader anymore.

When JGit is used in an OSGi framework, the cleanups must run on bundle
deactivation, not on JVM shut down.

Add a declarative OSGi service CleanupService. This is a normal Java
class that has no dependencies on any OSGi bundle or interface, but
that is declared in the MANIFEST.MF and in an OSGi Service XML as an
OSGi immediate component. Set the bundle activation policy to "lazy".
(A declarative service is used instead of a bundle activator because the
latter would need to implement the OSGi interface BundleActivator, but
JGit should not have dependencies on OSGi.)

When JGit runs in an OSGi framework, the framework will create an
instance of CleanupService through the no-args constructor when (and
before) the first class from this bundle is loaded. This instance thus
knows that it is operating in OSGi, and will run the ShutdownHook when
the bundle is deactivated: bundle deactivation will deactivate the
CleanupService instance.

When JGit does not run in an OSGi framework, the OSGi service
declaration will be ignored, and there will be no already existing
CleanupService instance. We create one lazily, which thus knows that
it is not operating in OSGi, and which will use a JVM shutdown hook to
run the ShutdownHook.

This also reverts commit e6d83d61eade6dee223757d149a4df9650752a55.

Bug: jgit-36
Change-Id: I9c621b0707453c087f638974312ea1bf8ec30c31
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months ago[diffmergetool] Fix running command on Cygwin 80/1177880/1
Thomas Wolf [Thu, 7 Mar 2024 21:42:27 +0000 (22:42 +0100)]
[diffmergetool] Fix running command on Cygwin

Because FS_Win32_Cygwin is a subclass of FS_Win32 the "instanceof" test
for Cygwin must come first.

Bug: jgit-34
Change-Id: If0cc0fa77e7aa0ce680289cecf808bc8859911a1
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months ago[releng] Bump japicmp base version to 6.9.0.202403050737-r 79/1177879/1
Thomas Wolf [Thu, 7 Mar 2024 21:57:44 +0000 (22:57 +0100)]
[releng] Bump japicmp base version to 6.9.0.202403050737-r

Change-Id: I6008ef632e6cd88d337ac5b888b52a4b1d3ca85f
Signed-off-by: Thomas Wolf <twolf@apache.org>
7 months agoDfsBlockCache: move cache table specific implementations to a new class 15/1177515/7
Laura Hamelin [Tue, 27 Feb 2024 17:40:24 +0000 (09:40 -0800)]
DfsBlockCache: move cache table specific implementations to a new class

This move of the cache table specific implementation to its own class
and extracting the method definition to an interface will allow for
additional reworking of the dfs block cache with the goal of letting
users implement their own context specific cache tables.

This work does not intend to change how the dfs block cache is accessed,
limiting the change to DfsBlockCache internal changes only.

Change-Id: Ief6755d1dcf54b4f73f9fe8d22ccb9e2952cb0c4
Signed-off-by: Laura Hamelin <haowl@google.com>
7 months agoPrepare 6.10.0-SNAPSHOT builds 70/1177370/1
Matthias Sohn [Tue, 5 Mar 2024 15:23:17 +0000 (16:23 +0100)]
Prepare 6.10.0-SNAPSHOT builds

Change-Id: Ie728ef9a7d3c6430a5da30f6a61afd2176015748

7 months agoMerge branch 'stable-6.9' 69/1177369/1
Matthias Sohn [Tue, 5 Mar 2024 15:22:35 +0000 (16:22 +0100)]
Merge branch 'stable-6.9'

* stable-6.9:
  Prepare 6.9.1-SNAPSHOT builds
  JGit v6.9.0.202403050737-r
  JGit v6.9.0.202403050045-r
  Prepare 6.9.0-SNAPSHOT builds
  JGit v6.9.0.202402281855-rc1
  Prepare 6.9.0-SNAPSHOT builds
  JGit v6.9.0.202402211805-m3

Change-Id: I08175c3bced7f94507a4def8fbf58c7d570e353c

7 months agoPrepare 6.9.1-SNAPSHOT builds 68/1177368/1
Matthias Sohn [Tue, 5 Mar 2024 14:55:07 +0000 (15:55 +0100)]
Prepare 6.9.1-SNAPSHOT builds

Change-Id: I10f901209be2faa34ebb9355c86c2106bac38ba5

7 months agoJGit v6.9.0.202403050737-r 66/1177366/1 v6.9.0.202403050737-r
Matthias Sohn [Tue, 5 Mar 2024 07:36:32 +0000 (08:36 +0100)]
JGit v6.9.0.202403050737-r

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

7 months agoJGit v6.9.0.202403050045-r 65/1177365/1 v6.9.0.202403050045-r
Matthias Sohn [Tue, 5 Mar 2024 00:43:03 +0000 (01:43 +0100)]
JGit v6.9.0.202403050045-r

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

7 months agoMerge branch 'master' into stable-6.9 62/1177362/1
Matthias Sohn [Mon, 4 Mar 2024 23:39:56 +0000 (00:39 +0100)]
Merge branch 'master' into stable-6.9

* master:
  Introduce core.trustLooseRefStat config

Change-Id: I373138c4334d94b3e1e4335ee555b68f907d4c89

7 months agoPrepare 6.9.0-SNAPSHOT builds 61/1177361/1
Matthias Sohn [Mon, 4 Mar 2024 23:39:41 +0000 (00:39 +0100)]
Prepare 6.9.0-SNAPSHOT builds

Change-Id: Ifadeead735c8772e58dd4e5c7381b44c5221a295

7 months agoIntroduce core.trustLooseRefStat config 16/1177316/7
Kaushik Lingarkar [Thu, 22 Feb 2024 23:29:48 +0000 (15:29 -0800)]
Introduce core.trustLooseRefStat config

With repositories on NFS, JGit can read an old value of a loose ref
or miss the existence of a loose ref if file attributes of the loose
ref or its parent directories are cached by NFS. Introduce a new config
'core.trustLooseRefStat' that will optionally refresh file attributes of
the loose ref (at least on some NFS clients).

Possible values for this new config are:

* always: Trust loose ref file attributes (default)
* after_open: Similar to 'always', but refresh the file attributes of
              the loose ref and its parent directories before trusting
              it

The default is set to always trust the file attributes as after_open is
known to degrade performance.

In a subsequent change, SnapshottingRefDirectory will be updated to
cache the directories that were refreshed to avoid duplicate work and
thereby improve performance to some extent for the after_open setting.

Change-Id: I9dfaeaf5307b2b51ce6ee4bfd9e0678786685fcf
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
7 months agoJGit v6.9.0.202402281855-rc1 58/1177358/1 v6.9.0.202402281855-rc1
Matthias Sohn [Wed, 28 Feb 2024 18:54:54 +0000 (19:54 +0100)]
JGit v6.9.0.202402281855-rc1

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

7 months agoMerge branch 'master' into stable-6.9 56/1177356/1
Matthias Sohn [Wed, 28 Feb 2024 18:43:26 +0000 (19:43 +0100)]
Merge branch 'master' into stable-6.9

* master:
  Update SECURITY.md
  DfsObjDatabase: Let object database instantiate DfsPackFiles
  DfsPackFile: Abstract the bitmap loading to support other backends
  Remove unused API problem filters
  Support public key in IdentityFile
  Revert "StartGenerator: Fix parent rewrite with non-default RevFilter"
  DfsReader#getObjectSize: use size index if possible

Change-Id: I60244aec1e44fe5b757a9b7ccb320697e0dc9b29

7 months agoMerge "Update SECURITY.md"
Matthias Sohn [Wed, 28 Feb 2024 13:14:02 +0000 (13:14 +0000)]
Merge "Update SECURITY.md"

7 months agoUpdate SECURITY.md 52/1177352/1
Matthias Sohn [Tue, 27 Feb 2024 23:40:34 +0000 (00:40 +0100)]
Update SECURITY.md

Use the text of the general Eclipse Vulnerability Reporting page at
https://www.eclipse.org/security.

Bug: jgit-31
Change-Id: I07dcf83199956e0173f958356661ade33252dab4

7 months agoDfsObjDatabase: Let object database instantiate DfsPackFiles 80/1177280/6
Ivan Frade [Thu, 22 Feb 2024 22:15:10 +0000 (14:15 -0800)]
DfsObjDatabase: Let object database instantiate DfsPackFiles

DfsPackfile used to have only one constructor and it is invoked from 3
locations. Now we can construct DfsPackFiles with different bitmap
loaders, so it is helpful to concentrate the instantiation in one location.

Create DfsPackFile instances in the object database. This let
subclasses choose how to initialize those instances.

Change-Id: Ibb2ad86865154b6e7f0d5d26e8f533e0b5586246

7 months agoDfsPackFile: Abstract the bitmap loading to support other backends 62/1177262/5
Ivan Frade [Wed, 21 Feb 2024 23:06:38 +0000 (15:06 -0800)]
DfsPackFile: Abstract the bitmap loading to support other backends

Current code reads the bitmap index from the pack extension and loads
all bitmaps into memory, with its IO and memory cost. We could
consider to store the bitmaps on e.g. a database and load them on
demand.

Abstract the loading of the PackBitmapIndex in an interface that can
be implemented with other backends.

Change-Id: Ib5f64d05954708ea5325feea7088a8df229b36a5

7 months agoRemove unused API problem filters 51/1177351/1
Matthias Sohn [Sun, 25 Feb 2024 22:28:33 +0000 (23:28 +0100)]
Remove unused API problem filters

Change-Id: I0d81fda5edde5348e765eebc39bd9293fba51e91

7 months agoMerge "Support public key in IdentityFile"
Thomas Wolf [Fri, 23 Feb 2024 12:30:07 +0000 (12:30 +0000)]
Merge "Support public key in IdentityFile"

7 months agoMerge "DfsReader#getObjectSize: use size index if possible"
Ivan Frade [Fri, 23 Feb 2024 00:23:43 +0000 (00:23 +0000)]
Merge "DfsReader#getObjectSize: use size index if possible"

7 months agoSupport public key in IdentityFile 73/1177073/6
Konrad Windszus [Tue, 20 Feb 2024 13:30:39 +0000 (14:30 +0100)]
Support public key in IdentityFile

Public keys in the SSH configuration's "IdentityFile" are used for
example by Password Managers like KeePassXC
(https://keepassxc.org/docs/#faq-ssh-agent-auth-errors) or 1Password
(https://developer.1password.com/docs/ssh/agent/advanced/#match-key-with-host)
to match keys in the SSH agent with specific hosts.

Bug: jgit-25
Change-Id: I33d47057d9dd54d3d08ba5bb17f730435ac93dac

7 months agoMerge "Revert "StartGenerator: Fix parent rewrite with non-default RevFilter""
Ivan Frade [Thu, 22 Feb 2024 05:40:55 +0000 (05:40 +0000)]
Merge "Revert "StartGenerator: Fix parent rewrite with non-default RevFilter""

7 months agoRevert "StartGenerator: Fix parent rewrite with non-default RevFilter" 16/1177216/1
Ivan Frade [Wed, 21 Feb 2024 23:28:03 +0000 (15:28 -0800)]
Revert "StartGenerator: Fix parent rewrite with non-default RevFilter"

This reverts commit db5ce6b5c24408ae27eb6fa0b6289d51b129baeb.

Reason to revert: This change utilizes the RewriteGenerator even in
absence of a path, making the walk lengthy.

Change-Id: I5ffa6e8fead328191348c1e46828bf8c75ae1e42

7 months agoPrepare 6.9.0-SNAPSHOT builds 99/1177199/1
Matthias Sohn [Wed, 21 Feb 2024 23:11:24 +0000 (00:11 +0100)]
Prepare 6.9.0-SNAPSHOT builds

Change-Id: I11f4871bfdf6c6c0de5d5ed577edf16bac8cf681

7 months agoJGit v6.9.0.202402211805-m3 96/1177196/1 v6.9.0.202402211805-m3
Matthias Sohn [Wed, 21 Feb 2024 18:04:49 +0000 (19:04 +0100)]
JGit v6.9.0.202402211805-m3

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

7 months agoMerge branch 'stable-6.8' 94/1177194/1
Matthias Sohn [Wed, 21 Feb 2024 17:18:31 +0000 (18:18 +0100)]
Merge branch 'stable-6.8'

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

Change-Id: I08095dfaefb963876d993383cb35acc6b75d7691

7 months agoMerge branch 'stable-6.7' into stable-6.8 93/1177193/1
Matthias Sohn [Wed, 21 Feb 2024 16:55:22 +0000 (17:55 +0100)]
Merge branch 'stable-6.7' into stable-6.8

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

Change-Id: I01749bae6f46d1a8ebd25b890e667cc092f3a659

7 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

7 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

7 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

7 months agoDfsReader#getObjectSize: use size index if possible 49/1177149/1
Ivan Frade [Tue, 20 Feb 2024 20:43:45 +0000 (12:43 -0800)]
DfsReader#getObjectSize: use size index if possible

getObjectSize reads the size from the first bytes of the object in the
pack, using IO. For blobs and depending on the configuration, the size
could be available in the object size index.

Try to get the size from the object size index if available. Read from
the pack otherwise.

Note that GC uses #getObjectSize from the existing pack to write the
next object size index.

Change-Id: Ia999290c06d061cb53aa8c0a2b28b1a9761567ef

7 months agoUpdate jetty to 10.0.20 79/1177079/1
Matthias Sohn [Tue, 20 Feb 2024 19:39:54 +0000 (20:39 +0100)]
Update jetty to 10.0.20

Change-Id: Ic79c5ce718fe1345f75c4254a9ee2aa7d91af359

7 months agoUpdate maven plugins 78/1177078/1
Matthias Sohn [Tue, 20 Feb 2024 17:47:48 +0000 (18:47 +0100)]
Update maven plugins

- build-helper-maven-plugin to 3.5.0
- cyclonedx-maven-plugin to 2.7.11
- eclipse-jarsigner-plugin to 1.4.3
- git-commit-id-maven-plugin to 7.0.0
- japicmp-maven-plugin to 0.18.5
- maven-clean-plugin to 3.3.2
- maven-compiler-plugin to 3.12.1
- maven-enforcer-plugin to 3.4.1
- maven-jxr-plugin to 3.3.2<
- maven-site-plugin to 4.0.0-M13
- spotbugs-maven-plugin to 4.8.3.1
- tycho plugins to 4.0.6

Change-Id: Ie792f783b8b8453a37743f10f8c4162932e5ff85

7 months agoUpdate org.assertj:assertj-core to 3.25.3 77/1177077/1
Matthias Sohn [Tue, 20 Feb 2024 16:46:35 +0000 (17:46 +0100)]
Update org.assertj:assertj-core to 3.25.3

Change-Id: I3fd8adf3c1cc3f2c8826602b11d1d11fdfe29bfb

7 months agoUpdate org.mockito:mockito-core to 5.10.0 76/1177076/1
Matthias Sohn [Tue, 20 Feb 2024 16:26:04 +0000 (17:26 +0100)]
Update org.mockito:mockito-core to 5.10.0

Change-Id: I35dbb2402e65753e10bef4617b7e1683f9900406

7 months agoUpdate org.apache.commons:commons-compress to 1.26.0 75/1177075/1
Matthias Sohn [Tue, 20 Feb 2024 16:00:22 +0000 (17:00 +0100)]
Update org.apache.commons:commons-compress to 1.26.0

The new version now requires commons-io for the tests.
Hence adding dependency to commons-io:commons-io:2.15.1.

Change-Id: Ieb50ef559a119c89f90d700ab95a73c0fcae85a8

7 months agoUpdate byte-buddy to 1.14.12 74/1177074/1
Matthias Sohn [Tue, 20 Feb 2024 14:06:33 +0000 (15:06 +0100)]
Update byte-buddy to 1.14.12

Change-Id: Idc56efd1ee6d9d1e039ccfffd5e16803b727f6dc

7 months agoAdd SystemReader.Delegate to reduce boiler-plate code needed to subclass 71/1177071/2
Matthias Sohn [Tue, 20 Feb 2024 00:12:55 +0000 (01:12 +0100)]
Add SystemReader.Delegate to reduce boiler-plate code needed to subclass

Original implementation by Han-Wen Nienhuys in Gerrit [1].

[1] https://gerrit-review.googlesource.com/c/gerrit/+/235169

Bug: jgit-24
Change-Id: I745f8c1c07de013a68168b91c2d9962d530d07bf

7 months agostorage.file: Do not throw NSFE when deleting tmp files 70/205470/2
Nasser Grainawi [Tue, 14 Nov 2023 20:55:48 +0000 (13:55 -0700)]
storage.file: Do not throw NSFE when deleting tmp files

If we try to delete a tmp file and it already doesn't exist, then
there's no problem and we don't need to throw an exception. This is
especially true for these existing cases using FileUtils.RETRY because
any missing files on retries are already considered successes. Not
throwing the exception quiets some logs and improves overall exception
handling.

Change-Id: Ia6e06ba042c5920d5cd9f8db2e1d829affa3d796
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
7 months agoFS.detectSymlinkSupport: fix a race 54/1174154/4
Motiejus Jakštys [Thu, 28 Dec 2023 14:33:28 +0000 (16:33 +0200)]
FS.detectSymlinkSupport: fix a race

When multiple JGit clients are instantiated concurrently, they may try
to create the same symlink at the same time. When that happens, the
second thread will return an error (because the symlink already exists)
and that `FS` instance will think that symlinks are not supported,
causing havoc.

Change-Id: I362b933ff63a1471e3a5d70cc8c35eb2f25cc0dd
Signed-off-by: Motiejus Jakštys <motiejus@jakstys.lt>
7 months agoMerge changes I8e577a23,Ic8e8b288
Matthias Sohn [Mon, 19 Feb 2024 23:13:18 +0000 (23:13 +0000)]
Merge changes I8e577a23,Ic8e8b288

* changes:
  Errorprone EscapedEntity: Do not use HTML entities inside @code javadoc
  ChangedPathFilter: Suppress warning about backing array (errorprone)

7 months agoMerge changes I9225d6a3,I9cf093ca,Id5a80635
Matthias Sohn [Mon, 19 Feb 2024 23:02:20 +0000 (23:02 +0000)]
Merge changes I9225d6a3,I9cf093ca,Id5a80635

* changes:
  RawParseUtils.nextLfSkippingSplitLines: fulfil contract as stated
  [gpg] Refactor the GpgSignatureVerifier
  RawParseUtils: utility method to get a header value

8 months agoMerge branch 'stable-6.8' into master 29/1176929/1
Dariusz Luksza [Thu, 15 Feb 2024 10:48:55 +0000 (10:48 +0000)]
Merge branch 'stable-6.8' into master

* stable-6.8:
  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
  [errorprone] Fix wrong comparison which always evaluated to false
  [errorprone] Remove unnecessary comparison

Change-Id: I1d65c41292779dd5f8f46bc0adefbfc9a62ba2ce

8 months agoMerge branch 'stable-6.7' into stable-6.8 28/1176928/1
Dariusz Luksza [Thu, 15 Feb 2024 10:43:11 +0000 (10:43 +0000)]
Merge branch 'stable-6.7' into stable-6.8

* stable-6.7:
  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
  [errorprone] Fix wrong comparison which always evaluated to false
  [errorprone] Remove unnecessary comparison

Change-Id: Ic6312bd3b2b1db38a287ebc7f31062251341438a

8 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

8 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>
8 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

8 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>
8 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>
8 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>
8 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)

8 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)

8 months agoMerge branch 'stable-6.8' into master 48/1176748/1
Dariusz Luksza [Mon, 12 Feb 2024 10:14:29 +0000 (10:14 +0000)]
Merge branch 'stable-6.8' into master

* stable-6.8:
  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: Icae170f85d71e65c308078648ae85dfc8308176d

8 months agoMerge branch 'stable-6.7' into stable-6.8 47/1176747/1
Dariusz Luksza [Mon, 12 Feb 2024 09:58:41 +0000 (09:58 +0000)]
Merge branch 'stable-6.7' into stable-6.8

* stable-6.7:
  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: I409d1dc3354ad65c048d2c40f39071a1207246c6

8 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

8 months agoErrorprone EscapedEntity: Do not use HTML entities inside @code javadoc 53/1176853/1
Ivan Frade [Fri, 9 Feb 2024 17:31:57 +0000 (09:31 -0800)]
Errorprone EscapedEntity: Do not use HTML entities inside @code javadoc

Change-Id: I8e577a23e7fbe22a3024ad62144e7f19eec465c3

8 months agoChangedPathFilter: Suppress warning about backing array (errorprone) 52/1176852/1
Ivan Frade [Fri, 9 Feb 2024 17:18:37 +0000 (09:18 -0800)]
ChangedPathFilter: Suppress warning about backing array (errorprone)

Errorprone warns about direct access to the underlying array.

That is the intention of this code, and those ByteBuffers are created
with ByteBuffer#wrap() so it should be safe.

Change-Id: Ic8e8b288f08ac794cf7f09dfccfefcba0a4685bf

8 months agoPackWriterBitmapPreparer: Do not generate bitmaps for excessive branch tips. 70/1176570/8
jackdt@google.com [Wed, 7 Feb 2024 19:12:46 +0000 (19:12 +0000)]
PackWriterBitmapPreparer: Do not generate bitmaps for excessive branch tips.

In https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1174407, I changed the bitmap selection algorithm to cap the number of branches included in the bitmap.

There was a bug in that change. When the selection algorithm iterates
over the commits in a branch B, it automatically includes a bitmap for
the tip of any other branch C that happens to be on B. So even though we never iterated over C, we would still index the tip commit of C.

Keep a list of the "excessive" branch tips and check that the commit is not in there before generating a bitmap. We only skip tips that would be selected as a result of being a tip.  If it would be selected for some other reason (e.g. it is one of the first 100 commits in master) then it is not skipped.

Change-Id: Ic8b4f82e816eac649a47c8918a41ed4ff0d877cd

8 months agoDon't use localized String during JVM shutdown 56/1176056/1
Matthias Sohn [Tue, 6 Feb 2024 09:23:37 +0000 (10:23 +0100)]
Don't use localized String during JVM shutdown

During shutdown the JGitText class may already be unloaded causing
NoClassDefFoundError.

Bug: jgit-17
Change-Id: I657b5a508efc8b3778be346d640f4e4d69abd5c5

8 months agoRawParseUtils.nextLfSkippingSplitLines: fulfil contract as stated 28/1176328/1
Thomas Wolf [Thu, 1 Feb 2024 18:24:15 +0000 (19:24 +0100)]
RawParseUtils.nextLfSkippingSplitLines: fulfil contract as stated

If there is no newline after the last header, the method is supposed to
return the buffer length, but it returned buffer.length - 1.

Change-Id: I9225d6a35a002244c246bc8781ceaf4369fb9a60

8 months ago[gpg] Refactor the GpgSignatureVerifier 27/1176327/1
Thomas Wolf [Thu, 1 Feb 2024 18:09:50 +0000 (19:09 +0100)]
[gpg] Refactor the GpgSignatureVerifier

Add a new method verify(GpgConfig, byte[], byte[]) and deprecate the
existing verify(byte[], byte[]). Some implementations of the interface
may need the GpgConfig.

Factor out extracting the raw armored signature from commits or tags
into an abstract AbstractGpgSignatureVerifier class so that different
implementations don't have to re-implement that bit. Call the new verify
method, passing along the GpgConfig.

This makes the GPG interfaces more versatile and facilitates
implementing an alternate GpgSignatureVerifier.

Change-Id: I9cf093caa9fdebede801d665f2591cd9b275e1fd

8 months agoRawParseUtils: utility method to get a header value 26/1176326/1
Thomas Wolf [Fri, 19 Jan 2024 16:37:43 +0000 (17:37 +0100)]
RawParseUtils: utility method to get a header value

The new method takes care of removing the leading blanks on continuation
lines in multi-line headers.

Change-Id: Id5a8063512a2abc3177c104d6ba8fa50d0dc6352

8 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)

8 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)

8 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)

8 months agoRebaseCommand: fix stopping on root commit conflicts 94/1174394/2
Thomas Wolf [Wed, 10 Jan 2024 17:36:50 +0000 (18:36 +0100)]
RebaseCommand: fix stopping on root commit conflicts

If rebasing runs into a conflict when applying a root commit from an
independent branch, there is no parent commit. Write an empty patch
file in that case like C git does.

Bug: jgit-6
Change-Id: I315313673d2abf29639d7d96c958d599961ba276
Signed-off-by: Thomas Wolf <twolf@apache.org>
8 months agoImprove handling of NFS stale handle errors 53/205553/5
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

8 months agoFix handling of missing pack index file 52/205552/4
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>
8 months agoCherryPick: add ability to customise cherry-picked commit message 14/1172614/7
Dmitrii Naumenko [Wed, 22 Nov 2023 18:11:17 +0000 (19:11 +0100)]
CherryPick: add ability to customise cherry-picked commit message

Originally I wanted to support a feature similar to `-x` options from
https://git-scm.com/docs/git-cherry-pick#_options.
The idea was to append original commit hash in this format:
```
my original commit message

(cherry picked from commit 75355897dc28e9975afed028c1a6d8c6b97b2a3c)
```
This can be useful information in some integrations.
I decided to make it in a more generic way
and pass custom `CherryPickCommitMessageProvider` implementation.
One of the two default implementations can append original commit hash

Change-Id: Id664e8438b0b76c5cb9b58113887eec04aa6f611

8 months agoRawParseUtils: Add missing @since tag for new API method 54/1176054/1
Matthias Sohn [Mon, 22 Jan 2024 21:43:31 +0000 (22:43 +0100)]
RawParseUtils: Add missing @since tag for new API method

This method was introduced in 8116f66b9c.

Change-Id: Ifd3341a03464a1d7164c176cf3a6cf83f45a2747

8 months agoSilence API warning for new constant 53/1176053/1
Matthias Sohn [Mon, 22 Jan 2024 21:40:52 +0000 (22:40 +0100)]
Silence API warning for new constant

and remove unused API problem filters.

Change-Id: Ia6f4fcc98b786e3e4b65f9e42cc60bbf6ca7c289

8 months ago[ssh] Bump Apache MINA sshd 2.11.0 -> 2.12.0 76/1174776/2
Thomas Wolf [Fri, 12 Jan 2024 20:23:47 +0000 (21:23 +0100)]
[ssh] Bump Apache MINA sshd 2.11.0 -> 2.12.0

This includes the upstream fix for CVE-2023-48795[1] ("strict KEX"
protocol extension mitigating the "Terrapin attack"[2]) in JGit.

[1] https://nvd.nist.gov/vuln/detail/CVE-2023-48795
[2] https://www.terrapin-attack.com/

Bug: jgit-16
Change-Id: Ie9aa5b903ea6795bd1511afea0bebdb537b56148
Signed-off-by: Thomas Wolf <twolf@apache.org>
8 months agoMerge branch 'stable-6.8' 07/1174607/1
Matthias Sohn [Sat, 20 Jan 2024 00:03:52 +0000 (01:03 +0100)]
Merge branch 'stable-6.8'

* stable-6.8:
  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: Ifdd88eed34be3a1f4897b468392fd86bbc3f3a64

8 months agoMerge branch 'stable-6.7' into stable-6.8 06/1174606/1
Matthias Sohn [Fri, 19 Jan 2024 23:40:42 +0000 (00:40 +0100)]
Merge branch 'stable-6.7' into stable-6.8

* stable-6.7:
  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: I5d49a9dc7da17b83243229d4d8d3b9ee0a063e65

8 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

8 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>
8 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

8 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

8 months agoAdd tests for handling pack files removal during fetch 46/205546/6
Dariusz Luksza [Fri, 17 Nov 2023 19:28:53 +0000 (19:28 +0000)]
Add tests for handling pack files removal during fetch

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

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

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

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

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

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

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

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

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