]> source.dussan.org Git - jgit.git/log
jgit.git
4 years agoDirCache: support index V4 03/167503/4
Thomas Wolf [Mon, 10 Aug 2020 19:38:50 +0000 (21:38 +0200)]
DirCache: support index V4

Index format version 4 was introduced in C git in 2012. It's about
time that JGit can deal with it.

Version 4 added prefix path compression. Instead of writing the full
path for each index entry to disk, only the difference to the previous
entry's path is written: a variable-encoded int telling how many bytes
to remove from the previous entry's path to get the common prefix,
followed by the new suffix.

Also, cache entries in a version 4 index are not padded anymore.

Internally, version 3 and version 4 index entries are identical; it's
only the stored format that changes.

Implement this path compression, and make sure we write an index file
that we read previously in the same format. (Only changing from version
2 to version 3 if there are extended flags.)

Add support for the "feature.manyFiles" and the "index.version" git
configs, and honor them when writing a new index file.

Add tests, including a compatibility test that verifies that JGit can
read a version 4 index generated by C git and write an identical
version 4 index.

Bug: 565774
Change-Id: Id83241cf009e50f950eb42f8d56b834fb47da1ed
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoUpdate javadoc for RemoteSession and SshSessionFactory 18/167418/4
Thomas Wolf [Sat, 8 Aug 2020 09:53:43 +0000 (11:53 +0200)]
Update javadoc for RemoteSession and SshSessionFactory

The timeout on RemoteSession.exec() cannot be a timeout for the
whole command. It can only be a timeout for setting up the process;
after that it's the application's responsibility to implement some
timeout for the execution of the command, for instance by calling
Process.waitFor(int, TimeUnit) or through other means.

Sessions returned by an SshSessionFactory are already connected and
authenticated -- they must be, because RemoteSession offers no
operations for connecting or authenticating a session.

Change the implementation of SshdExecProcess.waitFor() to wait
indefinitely. The original implementation used the timeout from
RemoteSession.exec() because of that erroneous javadoc.

Change-Id: I3c7ede24ab66d4c81f72d178ce5012d383cd826e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoFix JSchProcess.waitFor() with time-out 70/167370/13
Thomas Wolf [Thu, 6 Aug 2020 21:43:40 +0000 (23:43 +0200)]
Fix JSchProcess.waitFor() with time-out

SshSupport.runSshCommand() had a comment that wait with time-out
could not be used because JSchProcess.exitValue() threw the wrong
unchecked exception when the process was still running.

Fix this and make JSchProcess.exitValue() throw the right exception,
then wait with a time-out in SshSupport.

The Apache sshd client's SshdExecProcess has always used the correct
IllegalThreadStateException.

Add tests for SshSupport.runCommand().

Change-Id: Id30893174ae8be3b9a16119674049337b0cf4381
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agosshd: work around a race condition in Apache MINA sshd 2.4.0/2.5.x 83/167183/6
Thomas Wolf [Mon, 3 Aug 2020 14:22:37 +0000 (16:22 +0200)]
sshd: work around a race condition in Apache MINA sshd 2.4.0/2.5.x

When exceptions occur very early in the SSH connection setup, it's
possible that an exception gets lost. A subsequent authentication
attempt may then never be notified of the failure, and then wait
indefinitely or until its timeout expires.

This is caused by race conditions in sshd. The issue has been reported
upstream as SSHD-1050,[1] but will be fixed at the earliest in sshd
2.6.0.

[1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-1050

Bug: 565394
Change-Id: If9b62839db38f9e59a5e1137c2257039ba82de98
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agosshd: store per-session data on the sshd session object 67/166867/3
Thomas Wolf [Sat, 25 Jul 2020 08:20:29 +0000 (10:20 +0200)]
sshd: store per-session data on the sshd session object

Don't store session properties on the client but in a dedicated
per-session object that is attached to the sshd session.

Also make sure that each sshd session gets its own instance of
IdentityPasswordProvider that asks for passphrases of encrypted
private keys, and also store it on the session itself.

Bug: 563380
Change-Id: Ia88bf9f91cd22b5fd32b5972d8204d60f2de56bf
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge changes from topic "sshd"
Thomas Wolf [Wed, 5 Aug 2020 06:50:31 +0000 (02:50 -0400)]
Merge changes from topic "sshd"

* changes:
  sshd: use PropertyResolver in test
  Remove dependency on JSch from SSH test framework

4 years agoFilterSpec: Use BigInteger.ZERO instead of valueOf(0) 40/167140/1
Jonathan Nieder [Sat, 1 Aug 2020 02:01:35 +0000 (19:01 -0700)]
FilterSpec: Use BigInteger.ZERO instead of valueOf(0)

This just simplifies a bit by avoiding an unneeded method call.

Change-Id: I6d8d2fc512d8f8a82da73c355017d0abf833a13b

4 years agoDo not send empty blob in response to blob:none filter 34/167034/6
Jonathan Nieder [Thu, 30 Jul 2020 02:18:51 +0000 (19:18 -0700)]
Do not send empty blob in response to blob:none filter

If I create a repository containing an empty file and clone it
with

git clone --no-checkout --filter=blob:none \
https://url/of/repository

then I would expect no blobs to be transferred over the wire.  Alas,
JGit rewrites filter=blob:none to filter=blob:limit=0, so if the
repository contains an empty file then the empty blob gets
transferred.

Fix it by teaching JGit about filters based on object type to
complement the existing filters based on object size.  This prepares
us for other future filters such as object:none.

In particular, this means we do not need to look up the size of the
filtered blobs, which should speed up clones.  Noticed by Anna
Pologova and Terry Parker.

Change-Id: Id4b234921a190c108d8be2c87f54dcbfa811602a
Signed-off-by: Jonathan Nieder <jrn@google.com>
4 years agoAdd support for tree filters when fetching 36/167036/2
Jonathan Nieder [Thu, 30 Jul 2020 03:40:50 +0000 (20:40 -0700)]
Add support for tree filters when fetching

Teach the FilterSpec serialization code about tree filters so they can
be communicated over the wire and understood by the server.

While we're here, harden the FilterSpec serialization code to throw
IllegalStateException if we encounter a FilterSpec that cannot be
expressed as a "filter" line.  The only public API for creating a
Filterspec is to pass in a "filter" line to be parsed, so these should
not appear in practice.

Change-Id: I9664844059ffbc9c36eb829e2d860f198b9403a0
Signed-off-by: Jonathan Nieder <jrn@google.com>
4 years agosshd: use PropertyResolver in test 17/166917/1
Thomas Wolf [Tue, 28 Jul 2020 07:44:43 +0000 (09:44 +0200)]
sshd: use PropertyResolver in test

Improve the SshTestGitServer API for accessing the server properties.
Instead of returning the raw property map, return the proper sshd API
abstraction PropertyResolver.

This makes the interface more resilient against upstream changes.

Change-Id: Ie5b685bddc4e59f3eb6c121026d3658d57618ca4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoFS_POSIX: avoid prompt to install the XCode tools on OS X 20/165220/4
Thomas Wolf [Fri, 19 Jun 2020 13:29:57 +0000 (15:29 +0200)]
FS_POSIX: avoid prompt to install the XCode tools on OS X

OS X ships with a default /usr/bin/git that is just a wrapper that
at run-time delegates to the selected XCode toolchain, and that
prompts the user to install the XCode command line tools if not
already installed.

This is annoying for people who don't want to do so, since they'll
be prompted on each Eclipse start. Also, since on OS X the $PATH for
applications started via the GUI is not the same as the $PATH as set
via the shell profile, just using /usr/bin/git (which will normally
be found when JGit runs inside Eclipse) may give slightly surprising
results if the user has installed a non-Apple git and changed his
$PATH in the shell such that the non-Apple git is used in the shell.
(For instance by placing /usr/local/bin earlier on the path.) Eclipse
and the shell will use different git executables, and thus different
git system configs.

Therefore, try to find git via bash --login -c 'which git' not only
if we couldn't find it on $PATH but also if we found the default git
/usr/bin/git. If that finds some other git, use that. If the bash
approach also finds /usr/bin/git, double check via xcode-select -p
that an XCode git is present. If not, assume there is no git installed,
and work without any system config.

Bug: 564372
Change-Id: Ie9d010ebd9437a491ba5d92b4ffd1860c203f8ca
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoRemove dependency on JSch from SSH test framework 66/166866/1
Thomas Wolf [Sat, 27 Jun 2020 13:01:01 +0000 (15:01 +0200)]
Remove dependency on JSch from SSH test framework

Use standard java.security to generate test keys, use sshd to write
public key files, and write PKCS#8 PEM files for our non-encrypted
test private keys. This is a format that both JSch and Apache MINA
sshd can read.

Change-Id: I6ec55cfd7346b672a7fb6139d51abfb06d81a394
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoUse LinkedBlockingQueue for executor determining filesystem attributes 67/166767/2
Matthias Sohn [Fri, 17 Jul 2020 15:26:17 +0000 (17:26 +0200)]
Use LinkedBlockingQueue for executor determining filesystem attributes

Using a fixed thread pool with unbounded LinkedBlockingQueue fixes the
RejectedExecutionException thrown if too many threads try to
concurrently determine filesystem attributes.

Comparing that to an alternative implementation using an unbounded
thread pool instead showed similar performance with the reproducer (in
range of 100-1000 threads in reproducer) on my mac:

threads   time

fixed threadpool up to 5 threads with LinkedBlockingQueue of unlimited
queue size
100       1103 ms
200       1602 ms
300       2369 ms
500       4002 ms
1000      11071 ms

unbounded cached threadpool
100       1108 ms
200       1591 ms
300       2299 ms
500       4577 ms
1000      11196 ms

Bug: 564202
Change-Id: I773da7414a1dca8e548349442dca9b56643be946
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoBazel: Add workspace status command to stamp final artifact 68/165268/7
David Ostrovsky [Sun, 21 Jun 2020 14:56:57 +0000 (16:56 +0200)]
Bazel: Add workspace status command to stamp final artifact

Include implementation version in jgit library. This version is used
by other products that depend on JGit, and built using Bazel and not
consume officially released artifact from Central or Eclipse own Maven
repository.

Most notably, in Gerrit Code Review JGit agent that was previously
reported as "unknown", is now reported as:

  JGit/v5.8.0.202006091008-r-16-g14c43828d

using this change [1].

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

Change-Id: Ia50de9ac35b8dbe9e92d8ad7d0d14cd00f057863
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoDiffFormatter: correctly deal with tracked files in ignored folders 83/166183/2
Thomas Wolf [Sat, 11 Jul 2020 13:29:04 +0000 (15:29 +0200)]
DiffFormatter: correctly deal with tracked files in ignored folders

In JGit 5.0, the FileTreeIterator was changed to skip ignored folders
by default. To catch tracked files inside ignored folders, the tree
walk needs to have a DirCacheIterator, and the FileTreeIterator has
to know about that DirCacheIterator via setDirCacheIterator(). (Or
the optimization has to be switched off explicitly via
setWalkIgnoredDirectories(true).)

Skipping ignored directories is an important optimization in some
cases, for instance in node.js/npm projects, where we'd otherwise
traverse the whole huge and deep hierarchy of the typically ignored
node_modules folder.

While all uses of WorkingTreeIterator in JGit had been adapted,
DiffFormatter was forgotten. To make it work correctly (again) also
for such cases, make it set up a WorkingTreeeIterator automatically,
and make sure the WorkingTreeSource can find such files, too. Also
pass the repository to the TreeWalks used inside the DiffFormatter
to pick up the correct attributes, filters, and line-ending settings.

Bug: 565081
Change-Id: Ie88ac81166dc396ba28b83313964c1712b6ca199
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge branch 'stable-5.8' 00/166300/1
Matthias Sohn [Tue, 14 Jul 2020 22:56:08 +0000 (00:56 +0200)]
Merge branch 'stable-5.8'

* stable-5.8:
  Prepare 5.8.2-SNAPSHOT builds
  JGit v5.8.1.202007141445-r

Change-Id: I52960deec1f942b59817e34ea41688c8439a0927
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.8.2-SNAPSHOT builds 99/166299/1
Matthias Sohn [Tue, 14 Jul 2020 18:53:51 +0000 (20:53 +0200)]
Prepare 5.8.2-SNAPSHOT builds

Change-Id: I33327417cd5f5b55e860c5d9c6ee06cac7d10b44
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.8.1.202007141445-r 86/166286/1 v5.8.1.202007141445-r
Matthias Sohn [Tue, 14 Jul 2020 18:43:21 +0000 (20:43 +0200)]
JGit v5.8.1.202007141445-r

Change-Id: Ib63831292eded15af18ed30a9653831dadfd0d4a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUpdate Jetty to 9.4.30.v20200611 21/166021/2
Matthias Sohn [Wed, 8 Jul 2020 22:18:05 +0000 (00:18 +0200)]
Update Jetty to 9.4.30.v20200611

Change-Id: I9e14502f290483ad755aac30acd1e256f8abc8f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix writing GPG signatures with trailing newline 73/165173/2
Thomas Wolf [Thu, 18 Jun 2020 16:27:45 +0000 (18:27 +0200)]
Fix writing GPG signatures with trailing newline

Make sure we don't produce a spurious empty line at the end.

Bug: 564428
Change-Id: Ib991d93fbd052baca65d32a7842f07f9ddeb8130
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoRename a test method 31/165831/1
Thomas Wolf [Sat, 4 Jul 2020 13:14:17 +0000 (15:14 +0200)]
Rename a test method

Change-Id: Ibb0bf0b1895a07a80a1f73d2fd6df2cb2d09fd77
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoAdd a test for upstream bug SSHD-1028 14/165814/1
Thomas Wolf [Fri, 3 Jul 2020 18:43:00 +0000 (20:43 +0200)]
Add a test for upstream bug SSHD-1028

SSHD-1028:[1] server doesn't close server-side sessions properly when
client disconnects.

[1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-1028

Change-Id: I0d67f49e35abe8375cb1370a494dc01d0fb2c9b1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoImprove error message when receive.maxCommandBytes is exceeded 98/165498/3
David Pursehouse [Fri, 26 Jun 2020 05:23:29 +0000 (14:23 +0900)]
Improve error message when receive.maxCommandBytes is exceeded

The message "Too many commands" implies there is a hard limit on the
number of commands, which isn't the case. The limit is on the total
size of the received data, as explained in change I84317d396 which
introduced the configuration setting receive.maxCommandBytes:

  shorter reference names allow for more commands, longer reference
  names permit fewer commands per batch.

Change the message to:

  Commands size exceeds limit defined in receive.maxCommandBytes

Change-Id: I678b78f919b2fec8f8058f3403f2541c26a5d00e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoLfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loop 00/165500/4
David Pursehouse [Fri, 26 Jun 2020 08:18:08 +0000 (17:18 +0900)]
LfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loop

When iterating over the remote URLs to find one that matches "origin",
it always exits after the first iteration whether it has found the
remote or not. The break should be inside the conditional block so
that it exits when "origin" is found, otherwise continues to iterate
over the remaining remote URLs.

Found by Sonar Lint.

Change-Id: Ic969e54071d1cf095334007c1c1bab6579044dd2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoDiffFormatterTest: Add a test to confirm the default rename detection settings 97/165497/1
David Pursehouse [Fri, 26 Jun 2020 02:23:47 +0000 (11:23 +0900)]
DiffFormatterTest: Add a test to confirm the default rename detection settings

Add a test that confirms:

- No rename detector is initialized by default

- Rename detector is initialized after calling setDetectRenames(true)

- Rename limit and rename score have the default values 400 and
  60, respectively. Note that there are no constants for these values
  so the test hard codes them.

Change-Id: I327e2b348a40ef67d8a184e5ab09f4e9ab573e1c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade maven-site-plugin to 3.9.1 59/165459/1
David Pursehouse [Thu, 25 Jun 2020 10:05:07 +0000 (19:05 +0900)]
Upgrade maven-site-plugin to 3.9.1

Change-Id: I8fd46eef2851d48429b21c543c2441efcb1378fe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade build-helper-maven-plugin to 3.2.0 47/165347/2
David Pursehouse [Tue, 23 Jun 2020 10:44:19 +0000 (19:44 +0900)]
Upgrade build-helper-maven-plugin to 3.2.0

Change-Id: I1826a1641e026320d433031c45030712977e8151
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade spotbugs to 4.0.4 30/165330/2
David Pursehouse [Tue, 23 Jun 2020 01:26:05 +0000 (10:26 +0900)]
Upgrade spotbugs to 4.0.4

Change-Id: I774e625efe486383c66a034091da16500677466a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.8' 46/165446/1
Matthias Sohn [Wed, 24 Jun 2020 22:10:05 +0000 (00:10 +0200)]
Merge branch 'stable-5.8'

* stable-5.8:
  Add new osgi fragments to maven-central deploy scripts
  Do not require org.assertj.core.annotations

Change-Id: I338065e7d2bf95b59a13d09cff7aea0c7689fe42
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMergedReftable: Include the last reftable in determining minUpdateIndex 29/165329/2
Minh Thai [Mon, 22 Jun 2020 23:44:32 +0000 (16:44 -0700)]
MergedReftable: Include the last reftable in determining minUpdateIndex

MergedReftable ignores the last reftable in the stack while calculating the
minUpdateIndex.

Update the loop indices to include all reftables in the minUpdateIndex
calculation, while skipping position 0 as it is read outside the loop.

Change-Id: I12d3e714581e93d178be79c02408a67ab2bd838e
Signed-off-by: Minh Thai <mthai@google.com>
4 years agoAdd new osgi fragments to maven-central deploy scripts 69/165269/1
Matthias Sohn [Sat, 20 Jun 2020 07:25:06 +0000 (09:25 +0200)]
Add new osgi fragments to maven-central deploy scripts

Change-Id: I075b539fcc72f7492573426247134aed7a545fe9

4 years agoMerge "PackBitmapIndex: Not buffer inflated bitmap during bitmap creation."
Terry Parker [Sat, 20 Jun 2020 01:23:56 +0000 (21:23 -0400)]
Merge "PackBitmapIndex: Not buffer inflated bitmap during bitmap creation."

4 years agoPackBitmapIndex: Not buffer inflated bitmap during bitmap creation. 82/165082/4
Yunjie Li [Wed, 17 Jun 2020 18:58:18 +0000 (11:58 -0700)]
PackBitmapIndex: Not buffer inflated bitmap during bitmap creation.

Currently we're buffering the inflated bitmap entry in
BasePackBitmapIndex to optimize running time. However, this will use
lots of memory during the creation of the pack bitmap index file.

And change 161456, which rewrote the entire getBitmap method, increased
the fetch latency significantly.

This commit introduces getBitmapWithoutCaching method which is used in
the pack bitmap index file creation only and aims to save memory during
garbage collection and not increase fetch latency.

Change-Id: I7b982c9d4e38f5f6193eaa03894e894ba992b33b
Signed-off-by: Yunjie Li <yunjieli@google.com>
4 years agoDo not require org.assertj.core.annotations 29/165129/2
Sebastian Ratz [Thu, 18 Jun 2020 10:08:48 +0000 (11:08 +0100)]
Do not require org.assertj.core.annotations

Bug: 564410
Change-Id: I9797f1dbc9338056c4f8c43fddc4a998ca14e319
Signed-off-by: Sebastian Ratz <sebastian.ratz@sap.com>
4 years agoUpgrade ecj to 3.22.0 24/165124/1
David Pursehouse [Thu, 18 Jun 2020 09:31:14 +0000 (18:31 +0900)]
Upgrade ecj to 3.22.0

Change-Id: I97a99f6245afb49d916e226b16a5e60927f32353
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoRemove workaround for signing jars using Tycho plugins 62/164862/1
Matthias Sohn [Sun, 14 Jun 2020 18:46:02 +0000 (20:46 +0200)]
Remove workaround for signing jars using Tycho plugins

The workaround became obsolete when https://git.eclipse.org/r/#/c/16027/
was released.

Change-Id: Id20f79a1059550c1e5637fec30ae09a202cb2f2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUse https for URL of jgit website 61/164861/1
Matthias Sohn [Sun, 14 Jun 2020 18:39:27 +0000 (20:39 +0200)]
Use https for URL of jgit website

Change-Id: Ic9bcbac5de23f670ae6b008a201b1fe9c6478fab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix CI information in pom.xml 60/164860/1
Matthias Sohn [Sun, 14 Jun 2020 18:35:45 +0000 (20:35 +0200)]
Fix CI information in pom.xml

Change-Id: I066702cd9f4465eff919e46fc0cc8558d3f3178b

4 years agoUse gitiles as scm url in pom.xml for browsing source code 59/164859/1
Matthias Sohn [Sun, 14 Jun 2020 18:34:18 +0000 (20:34 +0200)]
Use gitiles as scm url in pom.xml for browsing source code

Change-Id: I6c18ffe822f62883d2f331ad77c28ce8afc3ebd8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUpdate API baseline to 5.8.0.202006091008-r 32/164632/1
Matthias Sohn [Wed, 10 Jun 2020 13:44:25 +0000 (15:44 +0200)]
Update API baseline to 5.8.0.202006091008-r

Change-Id: I3afc8a9ec5a49b9dd0b392b56fd1860a6285ec2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove trailing whitespace 01/164601/1
Matthias Sohn [Wed, 10 Jun 2020 08:47:29 +0000 (10:47 +0200)]
Remove trailing whitespace

Change-Id: I1635b79c8051699a3a5e78a4cef8d2014be4e92c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSimpleMergeTest: Clean up code style 87/164487/2
Demetr Starshov [Tue, 9 Jun 2020 02:00:54 +0000 (19:00 -0700)]
SimpleMergeTest: Clean up code style

Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: Ib0149279324a8b085eec4c60d02c8f32a8cc86bb

4 years agoMerge branch 'stable-5.8' 72/164572/1
Matthias Sohn [Tue, 9 Jun 2020 19:31:45 +0000 (21:31 +0200)]
Merge branch 'stable-5.8'

* stable-5.8:
  Prepare 5.8.1-SNAPSHOT builds
  Handle Fragment-Host declaration when updating version
  JGit v5.8.0.202006091008-r

Change-Id: I956947c8bbceb09f9cf9bfc58fff2ed6a15aba99
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.8.1-SNAPSHOT builds 37/164537/1
Matthias Sohn [Tue, 9 Jun 2020 14:45:56 +0000 (16:45 +0200)]
Prepare 5.8.1-SNAPSHOT builds

Change-Id: Ic654fb45abe4e94f4eee532af0f4278d372d37f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoHandle Fragment-Host declaration when updating version 36/164536/1
Matthias Sohn [Tue, 9 Jun 2020 10:47:57 +0000 (12:47 +0200)]
Handle Fragment-Host declaration when updating version

Change-Id: If7ad9c4b26025e4358e3b4228dda43fdf93d2978
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit a51b440840aa5f2cd20ae4c2edf6cdade18179df)

4 years agoJGit v5.8.0.202006091008-r 34/164534/1 v5.8.0.202006091008-r
Matthias Sohn [Tue, 9 Jun 2020 14:07:50 +0000 (16:07 +0200)]
JGit v5.8.0.202006091008-r

Change-Id: I2020e9821c359b90b7c830031945e2fc659ea607
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.9.0-SNAPSHOT builds 17/164517/1
Matthias Sohn [Tue, 9 Jun 2020 10:51:12 +0000 (12:51 +0200)]
Prepare 5.9.0-SNAPSHOT builds

Change-Id: Ia998e2772df1285a4c674b07201f15d53156eb78
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoHandle Fragment-Host declaration when updating version 16/164516/1
Matthias Sohn [Tue, 9 Jun 2020 10:47:57 +0000 (12:47 +0200)]
Handle Fragment-Host declaration when updating version

Change-Id: Ic1b17245f221496818a975bc4f07b74878d257a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge branch 'master' into stable-5.8 96/164396/1
Matthias Sohn [Sun, 7 Jun 2020 22:32:51 +0000 (00:32 +0200)]
Merge branch 'master' into stable-5.8

* master:
  Add benchmark for strategies how to move a file
  Add getter for unpackErrorHandler in ReceivePack
  Upgrade maven-project-info-reports-plugin to 3.1.0
  Upgrade maven-shade-plugin to 3.2.4
  ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
  ObjectDirectoryInserter: Remove redundant 'throws' declarations
  ObjectDirectory: Further clean up insertUnpackedObject
  Add Git#shutdown for releasing resources held by JGit process
  ApplyCommand: use context lines to determine hunk location
  GPG: don't prompt for a passphrase for unprotected keys
  Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST
  Fix ProtectedMembersInFinalClass warning flagged by error prone
  Use version range to define fragment host bundle version
  ObjectDirectory: Explicitly handle NoSuchFileException
  ObjectDirectory: Fail immediately when atomic move is not supported
  Fix jgit packaging
  Fix InvalidInlineTag error flagged by error prone
  Fix BadComparable error flagged by error prone
  Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash()
  Update Orbit to R20200529191137 for final Eclipse release 2020-06
  Organize manifest of org.eclipse.jgit.pgm
  Do not include log4j implementation in jgit
  Decouple JSch from JGit Core
  Decouple BouncyCastle from JGit Core
  Verify that the user home directory is valid
  WindowCache: conditional JMX setup
  RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace
  Revert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex"
  Update jetty to 9.4.28.v20200408
  Add 4.16 staging target platform
  In-memory SSH keys for the "no files" sshd tests
  Builder API to configure SshdSessionFactories
  TransportHttp: abort on time-out or on SocketException
  Ignore core.eol if core.autocrlf=input
  Attributes: fix handling of text=auto in combination with eol
  Bazel: Remove superfluous dependencies flagged by unused_deps
  Log stack trace if CachingKeyPairProvider hits unexpected exception
  Update Orbit to S20200519202422 and ant to 1.10.8
  Include full IssuerFingerprint in GPG signature
  Bazel: Fix src_sha1 of bcpg-jdk15on
  Suppress API error for new method BitmapIndex.Bitmap#retrieveCompressed
  Fix wrong @since tags added in dcb0265
  PackBitmapIndex: Set distance threshold
  PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex
  PackBitmapIndex: Remove convertedBitmaps in the Remapper
  PackBitmapIndex: Reduce memory usage in GC
  PackBitmapIndex: Add AddToBitmapWithCacheFilter class
  PackBitmapIndex: Add util methods and builder to BitmapCommit
  PackBitmapIndex: Move BitmapCommit to a top-level class
  Refactor: Make retriveCompressed an method of the Bitmap class
  Fix downloading LFS Object fails behind proxy
  Allow for using custom s3 host with lfs server
  ReceivePack: adding IterativeConnectivityChecker
  Moving transport/internal -> internal/transport
  Fix error occurring during checkout

Change-Id: I675cfb9eee956bab4903f28d8021115afc753dcd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoAdd benchmark for strategies how to move a file 54/164254/5
Matthias Sohn [Fri, 5 Jun 2020 11:01:11 +0000 (13:01 +0200)]
Add benchmark for strategies how to move a file

We can either
- try moving the file and, in case the target directory doesn't exist,
  handle the NoSuchFileException this raises to create the target
  directory
- or we always first test if the target directory exists and create it
 in case it is missing

On my Mac this yields

Benchmark                                        Mode  Cnt    Score     Error  Units
FileMoveBenchmark.moveFileToExistingDir        avgt    5  196.490 Â±  15.194  us/op
FileMoveBenchmark.moveFileToExistingDirExists  avgt    5  223.217 Â±  54.816  us/op
FileMoveBenchmark.moveFileToMissingDir         avgt    5  332.169 Â±  43.871  us/op
FileMoveBenchmark.moveFileToMissingDirExists   avgt    5  303.815 Â± 137.568  us/op

This means if the target directory of the move already exists the
first strategy is faster by around 25 us/op otherwise the second one
is faster by around 30 us/op. Which one is favorable depends on the
average probability that the target directory exists in real world
scenarios.

Change-Id: I03653b408b859a796508dfa1471b36c65633534e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge "Merge branch 'stable-5.7'"
Matthias Sohn [Fri, 5 Jun 2020 20:56:32 +0000 (16:56 -0400)]
Merge "Merge branch 'stable-5.7'"

4 years agoAdd getter for unpackErrorHandler in ReceivePack 18/163418/3
Jack Wickham [Fri, 22 May 2020 10:00:18 +0000 (11:00 +0100)]
Add getter for unpackErrorHandler in ReceivePack

The current mechanism for updating the unpack error handler requires
that the error handler is replaced entirely, including communicating
the error to the user. Adding a getter means that delegating
implementations can be constructed so that the error can be processed
before sending to the user, for example for logging.

Change-Id: I4b6f78a041d0f6f5b4076a9a5781565ca3857817
Signed-off-by: Jack Wickham <jwickham@palantir.com>
4 years agoMerge branch 'stable-5.7' 10/164210/2
David Pursehouse [Fri, 5 Jun 2020 08:09:38 +0000 (17:09 +0900)]
Merge branch 'stable-5.7'

* stable-5.7:
  ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
  ObjectDirectoryInserter: Remove redundant 'throws' declarations
  ObjectDirectory: Further clean up insertUnpackedObject
  ObjectDirectory: Explicitly handle NoSuchFileException
  ObjectDirectory: Fail immediately when atomic move is not supported

Change-Id: I05186baa517388680fcc6825c940c4c772f26d32
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade maven-project-info-reports-plugin to 3.1.0 74/164174/2
David Pursehouse [Thu, 4 Jun 2020 13:37:42 +0000 (22:37 +0900)]
Upgrade maven-project-info-reports-plugin to 3.1.0

Change-Id: I16e24bbec033ea707cb5c5a0ff3c21859e602f39
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade maven-shade-plugin to 3.2.4 73/164173/2
David Pursehouse [Thu, 4 Jun 2020 13:36:58 +0000 (22:36 +0900)]
Upgrade maven-shade-plugin to 3.2.4

Change-Id: Iba47e9304b6f20e8aa4855378bc86063919bb909
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoObjectDirectoryInserter: Open FileOutputStream in try-with-resource 23/164223/1
David Pursehouse [Fri, 5 Jun 2020 05:59:54 +0000 (14:59 +0900)]
ObjectDirectoryInserter: Open FileOutputStream in try-with-resource

Change-Id: Icc569aeefdc79baee5dfb71fb34d881c561dcf52
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoObjectDirectoryInserter: Remove redundant 'throws' declarations 22/164222/1
David Pursehouse [Fri, 5 Jun 2020 05:46:08 +0000 (14:46 +0900)]
ObjectDirectoryInserter: Remove redundant 'throws' declarations

ObjectWritingException and FileNotFoundException are subclasses
of IOException, which is already declared. Error does not need
to be explicitly declared.

Change-Id: I879820a33e10ec3a7ef676adc9c9148d2b3c4b27
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoObjectDirectory: Further clean up insertUnpackedObject 15/164215/1
David Pursehouse [Fri, 5 Jun 2020 02:34:49 +0000 (11:34 +0900)]
ObjectDirectory: Further clean up insertUnpackedObject

- The code to move the file is repeated. Split it out into a
  utility method.

- Remove the catch block for AtomicMoveNotSupportedException which
  is redundant because it's handled in exactly the same way as the
  IOException further down. The only exception we need to explicitly
  handle differently in this block is NoSuchFileException.

- Improve the comments.

Change-Id: Ifc5490953ffb25ecd1c48a06289eccb3f19910c6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoAdd Git#shutdown for releasing resources held by JGit process 58/154858/5
Matthias Sohn [Fri, 20 Dec 2019 01:23:05 +0000 (02:23 +0100)]
Add Git#shutdown for releasing resources held by JGit process

The shutdown method releases
- ThreadLocal held by NLS
- GlobalBundleCache used by NLS
- Executor held by WorkQueue

Bug: 437855
Bug: 550529
Change-Id: Icfdccd63668ca90c730ee47a52a17dbd58695ada
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoApplyCommand: use context lines to determine hunk location 19/161519/3
Thomas Wolf [Fri, 24 Apr 2020 13:00:01 +0000 (15:00 +0200)]
ApplyCommand: use context lines to determine hunk location

If a hunk does not apply at the position stated in the hunk header
try to determine its position using the old lines (context and
deleted lines).

This is still a far cry from a full git apply: it doesn't do binary
patches, it doesn't handle git's whitespace options, and it's perhaps
not the fastest on big patches. C git hashes the lines and uses these
hashes to speed up matching hunks (and to do its whitespace magic).

Bug: 562348
Change-Id: Id0796bba059d84e648769d5896f497fde0b787dd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoGPG: don't prompt for a passphrase for unprotected keys 69/163269/3
Thomas Wolf [Sat, 9 Nov 2019 21:05:53 +0000 (22:05 +0100)]
GPG: don't prompt for a passphrase for unprotected keys

BouncyCastle supports reading GPG keys without passphrase since 1.62.
Handle this in JGit, too, and don't prompt for a passphrase unless
it's necessary.

Make two passes over the private key files, a first pass without
passphrase provider. If that succeeds it has managed to read a
matching key without passphrase. Otherwise, ask the user for
the passphrase and make a second pass over the key files.

BouncyCastle 1.65 still has no method to get the GPG "key grip" from
a given public key, so JGit still cannot determine the correct file
to read up front. (The file name is the key grip as 40 hex digits,
upper case, with extension ".key").

Bug: 548763
Change-Id: I448181276548c08716d913c7ba1b4bc64c62f952
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge "Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST"
Matthias Sohn [Thu, 4 Jun 2020 15:59:40 +0000 (11:59 -0400)]
Merge "Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST"

4 years agoFix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST 84/164184/1
Thomas Wolf [Thu, 4 Jun 2020 15:10:38 +0000 (17:10 +0200)]
Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST

Change-Id: I1d1484b32aa0c6464b5c38f2a2987716589ae9aa
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoFix ProtectedMembersInFinalClass warning flagged by error prone 03/163403/4
David Ostrovsky [Fri, 22 May 2020 06:03:41 +0000 (08:03 +0200)]
Fix ProtectedMembersInFinalClass warning flagged by error prone

Running recent error prone version complaining on that code:

CharacterHead.java:22: error: [ProtectedMembersInFinalClass] Make
members of final classes package-private: <init>
protected CharacterHead(char expectedCharacter) {
          ^
    (see https://errorprone.info/bugpattern/ProtectedMembersInFinalClass)
  Did you mean 'CharacterHead(char expectedCharacter) {'

Bug: 562756
Change-Id: Ic46a0b07e46235592f6e63db631f583303420b73
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoUse version range to define fragment host bundle version 65/164165/1
Matthias Sohn [Thu, 4 Jun 2020 12:15:08 +0000 (14:15 +0200)]
Use version range to define fragment host bundle version

Change-Id: Ie877e976b20d3448fc1f12a1c775942d626a12fc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoObjectDirectory: Explicitly handle NoSuchFileException 21/164121/1
David Pursehouse [Thu, 4 Jun 2020 05:07:34 +0000 (14:07 +0900)]
ObjectDirectory: Explicitly handle NoSuchFileException

On the first attempt to move the temp file, NoSuchFileException can
be raised if the destination folder does not exist. Instead of handling
this implicitly in the catch of IOException and then continuing to
create the destination folder and try again, explicitly catch it and
create the destination folder. If any other IOException occurs, treat
it as an unexpected error and return FAILURE.

Subsequently, on the second attempt to move the temp file, if ANY kind
of IOException occurs, also consider this an unexpected error and
return FAILURE.

In both catch blocks for IOException, add logging at ERROR level.

Change-Id: I9de9ee3d2b368be36e02ee1c0daf8e844f7e46c8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoObjectDirectory: Fail immediately when atomic move is not supported 20/164120/1
David Pursehouse [Thu, 4 Jun 2020 04:51:17 +0000 (13:51 +0900)]
ObjectDirectory: Fail immediately when atomic move is not supported

If atomic move is not supported, AtomicMoveNotSupportedException will
be thrown on the first attempt to move the temp file. There is no
point attempting the move operation a second time because it will only
fail for the same reason.

Add an immediate return of FAILURE on the first occasion. Remove the
unnecessary handling of the exception in the second block.

Change-Id: I4658a8b37cfec2d7ef0217c8346e512968d0964c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoFix jgit packaging 66/164066/1
Matthias Sohn [Wed, 3 Jun 2020 11:51:46 +0000 (13:51 +0200)]
Fix jgit packaging

- new jsch and gpg.bc fragments need to be included in their features
  as fragments and require only the jgit bundle (not the jgit feature)
- feature org.eclipse.jgit should no longer include bouncycastle
- add missing url for gpg.bc feature in category.xml
- don't mark features as patch features

Change-Id: I4a46e3fed319221a704b754347a6798b4b199fe4

4 years agoFix InvalidInlineTag error flagged by error prone 02/163402/3
David Ostrovsky [Fri, 22 May 2020 05:53:59 +0000 (07:53 +0200)]
Fix InvalidInlineTag error flagged by error prone

Running recent error prone version complaining on that code:

RefDatabase.java:444: error: [InvalidInlineTag] Tag name `linkObjectId`
is unknown.
 * Includes peeled {@linkObjectId}s. This is the inverse lookup of
                   ^
    (see https://errorprone.info/bugpattern/InvalidInlineTag)

Bug: 562756
Change-Id: If91da51d5138fb753c0550eeeb9e3883a394123d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoFix BadComparable error flagged by error prone 01/163401/4
David Ostrovsky [Fri, 22 May 2020 05:49:49 +0000 (07:49 +0200)]
Fix BadComparable error flagged by error prone

Running recent error prone version complaining on that code:

LfsPointer.java:171: error: [BadComparable] Possible sign flip from
narrowing conversion
return (int) (getSize() - o.getSize());
       ^
    (see https://errorprone.info/bugpattern/BadComparable)
  Did you mean 'return Long.compare(getSize(), o.getSize());'?

Bug: 562756
Change-Id: I0522f1025319a9290c448a064fbafdb4b16d1d59
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoAdd tests for RawTextComparator.WS_IGNORE_CHANGE.hash() 94/163794/2
Thomas Wolf [Thu, 28 May 2020 17:40:01 +0000 (19:40 +0200)]
Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash()

Change-Id: I1ed4df789094e09c39b3c2054fe5b9bd0c1a8f9b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoUpdate Orbit to R20200529191137 for final Eclipse release 2020-06 05/163905/2
Thomas Wolf [Sun, 31 May 2020 14:43:41 +0000 (16:43 +0200)]
Update Orbit to R20200529191137 for final Eclipse release 2020-06

This includes org.bouncycastle.bcprov 1.65.1 in the p2 repository.

Leave the maven and bazel dependencies for Bouncy Castle at 1.65.

Change-Id: I1fb39bd79e7339315f64f8b5dda89cb81dd035af
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoOrganize manifest of org.eclipse.jgit.pgm 10/163910/2
Matthias Sohn [Sun, 31 May 2020 21:33:09 +0000 (23:33 +0200)]
Organize manifest of org.eclipse.jgit.pgm

Use "organize manifest" to auto-cleanup the manifest of
org.eclipse.jgit.pgm. This removes some unused imports and unnecessary
manifest headers and updates use clauses.

Change-Id: Iacbd6d3b184c6fa8db28d9f06cbf56e57cc8ef5d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoDo not include log4j implementation in jgit 07/133407/8
Michael Keppler [Mon, 3 Dec 2018 16:25:51 +0000 (17:25 +0100)]
Do not include log4j implementation in jgit

As discussed in the bug, jgit should not include a logging
implementation, and instead rely on the product containing jgit to
configure the logging.

We have recently run into the situation, that installing egit in a (non
eclipse.org) RCP application breaks all the logging due to incompatible
logging implementations. Removal of the jgit logging implementation
should fix this.

Following further changes have been done for jgit command line:
* added log4j.properties to binary build of jgit.pgm. That file existed
in the git repository, but was not included in the eclipse binary build.
(maybe it is in the bazel build)
* removed apache.commons.logging package import from jgit.pgm. That
import is not used, and makes the logging even more confusing.

Bug: 514326
Change-Id: I6dc7d1462f0acfca9e2b1ac87e705617179ffdda
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoDecouple JSch from JGit Core 53/156153/29
Matthias Sohn [Fri, 24 Apr 2020 20:41:39 +0000 (22:41 +0200)]
Decouple JSch from JGit Core

Motivation: JSch serves as 'default' implementations of the SSH
transport. If a client application does not use it then there is no need
to pull in this dependency.

Move the classes depending on JSch to an OSGi fragment extending the
org.eclipse.jgit bundle and keep them in the same package as before
since moving them to another package would break API. Defer moving them
to a separate package to the next major release.

Add a new feature org.eclipse.jgit.ssh.jsch feature to enable
installation. With that users can now decide which of the ssh client
integrations (JCraft JSch or Apache Mina SSHD) they want to install.
We will remove the JCraft JSch integration in a later step due to the
reasons discussed in bug 520927.

Bug: 553625
Change-Id: I5979c8a9dbbe878a2e8ac0fbfde7230059d74dc2
Also-by: Michael Dardis <git@md-5.net>
Signed-off-by: Michael Dardis <git@md-5.net>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoDecouple BouncyCastle from JGit Core 60/161560/17
Matthias Sohn [Sun, 26 Apr 2020 22:58:28 +0000 (00:58 +0200)]
Decouple BouncyCastle from JGit Core

Motivation: BouncyCastle serves as 'default' implementation of
the GPG Signer. If a client application does not use it there is no need
to pull in this dependency, especially since BouncyCastle is a large
library.

Move the classes depending on BouncyCastle to an OSGi fragment extending
the org.eclipse.jgit bundle. They are moved to a distinct internal
package in order to avoid split packages. This doesn't break public API
since these classes were already in an internal package before this
change.

Add a new feature org.eclipse.jgit.gpg.bc to enable installation. With
that users can now decide if they want to install it.

Attempts to sign a commit if org.eclipse.jgit.gpg.bc isn't available
will result in ServiceUnavailableException being thrown.

Bug: 559106
Change-Id: I42fd6c00002e17aa9a7be96ae434b538ea86ccf8
Also-by: Michael Dardis <git@md-5.net>
Signed-off-by: Michael Dardis <git@md-5.net>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoVerify that the user home directory is valid 71/163871/2
Thomas Wolf [Fri, 29 May 2020 19:57:37 +0000 (21:57 +0200)]
Verify that the user home directory is valid

If the determination of the user home directory produces a Java File
object with an invalid path, spurious exceptions may occur at the
most inopportune moments anytime later. In the case in the linked bug
report, start-up of EGit failed, leading to numerous user-visible
problems in Eclipse.

So validate the return value of FS.userHomeImpl(). If converting that
File to a Path throws an exception, log the problem and fall back to
Java system property user.home. If that also is not valid, use null.

(A null user home directory is allowed by FS, and calling in Java
new File(null, "some_string") is fine and produces a File relative
to the current working directory.)

Bug: 563739
Change-Id: If9eec0f9a31a45bd815231706285c71b09f8cf56
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoWindowCache: conditional JMX setup 70/163870/1
Thomas Wolf [Fri, 29 May 2020 21:04:44 +0000 (23:04 +0200)]
WindowCache: conditional JMX setup

Make it possible to programmatically suppress the JMX bean
registration. In EGit it is not needed but can be rather costly
because it occurs during plug-in activation and accesses the
git user config.

Bug: 563740
Change-Id: I07ef7ae2f0208d177d2a03862846a8efe0191956
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge "RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace"
Christian Halstrick [Thu, 28 May 2020 12:07:02 +0000 (08:07 -0400)]
Merge "RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace"

4 years agoRawTextComparator.WS_IGNORE_CHANGE must not compare whitespace 73/163573/3
Thomas Wolf [Tue, 26 May 2020 06:50:33 +0000 (08:50 +0200)]
RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace

Only the presence or absence of whitespace is significant; but not the
actual whitespace characters. Don't compare whitespace bytes.

Compare the C git implementation at [1].

[1] https://github.com/git/git/blob/0d0e1e8/xdiff/xutils.c#L173

Bug: 563570
Change-Id: I2d0522b637ba6b5c8b911b3376a9df5daa9d4c27
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoRevert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex" 00/163700/1
Yunjie Li [Wed, 27 May 2020 17:29:20 +0000 (10:29 -0700)]
Revert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex"

This reverts commit 3aee92478c2cbc67cd921533437b824e43ed9798, which
increased fetch latency significantly.

Change-Id: Id31a94dff83bf7ab2121718ead819bd08306a0b6
Signed-off-by: Yunjie Li <yunjieli@google.com>
4 years agoUpdate jetty to 9.4.28.v20200408 48/163648/1
Matthias Sohn [Tue, 26 May 2020 23:57:08 +0000 (01:57 +0200)]
Update jetty to 9.4.28.v20200408

Change-Id: I6fe26c1efcf812de3102ee82ce67f9e0bc3b0135
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoAdd 4.16 staging target platform 42/163642/1
Matthias Sohn [Tue, 26 May 2020 21:36:05 +0000 (23:36 +0200)]
Add 4.16 staging target platform

* replace 4.15 staging by 4.15 release
* add 4.16 staging

Change-Id: I33cc701f0ea6fffeaec898fa50ef536b20102048
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoIn-memory SSH keys for the "no files" sshd tests 33/161533/3
Thomas Wolf [Sun, 26 Apr 2020 14:43:28 +0000 (16:43 +0200)]
In-memory SSH keys for the "no files" sshd tests

Avoid using a key written to a file. This makes it clearer that
the test does not rely on files being present.

Change-Id: I31cf4f404aab5b891c32fc4bda906b7f8fe03777
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoBuilder API to configure SshdSessionFactories 48/161448/4
Thomas Wolf [Thu, 23 Apr 2020 16:30:19 +0000 (18:30 +0200)]
Builder API to configure SshdSessionFactories

A builder API provides a more convenient way to define a customized
SshdSessionFactory by hiding the subclassing.

Also provide a new interface SshConfigStore to abstract away the
specifics of reading a ssh config file, and provide a way to customize
the concrete ssh config implementation to be used. This facilitates
using an alternate ssh config implementation that may or may not be
based on files.

Change-Id: Ib9038e8ff2a4eb3a9ce7b3554d1450befec8e1e1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoTransportHttp: abort on time-out or on SocketException 87/162987/3
Thomas Wolf [Wed, 13 May 2020 18:06:23 +0000 (20:06 +0200)]
TransportHttp: abort on time-out or on SocketException

Avoid trying other authentication methods on SocketException or on
InterruptedIOException. SocketException is rather fatal, such as
nothing listening on the peer's port, connection reset, or it could
be a connection time-out.

Time-outs enforced by Timeout{Input,Output}Stream may result in
InterruptedIOException being thrown.

In both cases, it makes no sense to try other authentication methods,
and doing so may wrongly report "authentication not supported" or
"cannot open git-upload-pack" or some such instead of reporting a
time-out.

Bug: 563138
Change-Id: I0191b1e784c2471035e550205abd06ec9934fd00
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge "Bazel: Remove superfluous dependencies flagged by unused_deps"
David Pursehouse [Sat, 23 May 2020 07:36:35 +0000 (03:36 -0400)]
Merge "Bazel: Remove superfluous dependencies flagged by unused_deps"

4 years agoIgnore core.eol if core.autocrlf=input 22/160622/2
Thomas Wolf [Tue, 7 Apr 2020 22:07:47 +0000 (00:07 +0200)]
Ignore core.eol if core.autocrlf=input

Config core.eol is to be ignored if core.autocrlf is true or input.[1]
JGit didn't do so when core.autocrlf=input was set.

[1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreeol

Bug: 561877
Change-Id: I5e62e0510d160b5113c1090319af09c2bc1bcb59
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoAttributes: fix handling of text=auto in combination with eol 04/159904/4
Thomas Wolf [Mon, 23 Mar 2020 15:55:35 +0000 (16:55 +0100)]
Attributes: fix handling of text=auto in combination with eol

In Git 2.10.0 the interpretation of gitattributes changed or was fixed
such that "* text=auto eol=crlf" would indeed still do auto-detection
of text vs. binary content.[1] Previously this was identical to
"* text eol=crlf", i.e., treating all files as text.

JGit still did the latter, which caused surprises because it changed
binary files.

[1] https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248

Bug: 561341
Change-Id: I5b6fb97b5e86fd950a98537b6b8574f768ae30e5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoBazel: Remove superfluous dependencies flagged by unused_deps 51/150651/4
David Ostrovsky [Sun, 6 Oct 2019 13:28:44 +0000 (15:28 +0200)]
Bazel: Remove superfluous dependencies flagged by unused_deps

Bazel buildtools project includes in addition to buildifier also unused
deps and buildozer utilities, that detect unused dependencies and fix
them by applying the removal to the build files. This change is created
by installing unused_deps from buildtools@HEAD and running:

  $ unused_deps //...

and applying the suggested modifications.

Change-Id: Iad74ec2fa719475b29391586f40b13ae30477004
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
4 years agoLog stack trace if CachingKeyPairProvider hits unexpected exception 21/163321/1
Matthias Sohn [Wed, 20 May 2020 14:13:40 +0000 (16:13 +0200)]
Log stack trace if CachingKeyPairProvider hits unexpected exception

Log the stack trace in order to help understanding the bug 563380

Bug: 563380
Change-Id: If993a63ccec5042b10e1d5e945b18f4b5f06d8ff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUpdate Orbit to S20200519202422 and ant to 1.10.8 81/163281/2
Matthias Sohn [Wed, 20 May 2020 00:56:44 +0000 (02:56 +0200)]
Update Orbit to S20200519202422 and ant to 1.10.8

Change-Id: I5bc120a495deb2f3b29bd04bb1c9a2058394ba8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoInclude full IssuerFingerprint in GPG signature 62/161962/4
Thomas Wolf [Mon, 4 May 2020 09:38:46 +0000 (11:38 +0200)]
Include full IssuerFingerprint in GPG signature

Update dependency to Bouncy Castle to 1.65.

Add the IssuerFingerprint as a hashed sub-packet in the signature. If
added unhashed, GPG ignores it.

Bug: 553206
Change-Id: I6807e8e2385e6ec5790f388e4753a44aa9474ebb
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoBazel: Fix src_sha1 of bcpg-jdk15on 59/163159/2
David Pursehouse [Mon, 18 May 2020 01:25:13 +0000 (10:25 +0900)]
Bazel: Fix src_sha1 of bcpg-jdk15on

Test plan:

  bazel build //...

Change-Id: Ibf1d0b56785d62150bbae49b553c856efbe6d197
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoSuppress API error for new method BitmapIndex.Bitmap#retrieveCompressed 58/163158/1
Matthias Sohn [Sun, 17 May 2020 21:11:31 +0000 (23:11 +0200)]
Suppress API error for new method BitmapIndex.Bitmap#retrieveCompressed

OSGi semantic versioning allows breaking implementers in a minor
release.

Change-Id: Ib55dc43dd3b50b0ef39a7094190f230210aee4b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix wrong @since tags added in dcb0265 57/163157/1
Matthias Sohn [Sun, 17 May 2020 21:08:27 +0000 (23:08 +0200)]
Fix wrong @since tags added in dcb0265

This change was introduced in 5.8.

Change-Id: Ic74ebff5a0547bb55e0401b38f73ebc6e67cace9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge changes I39783eee,I874503ec,Ic942a8e4,I6ec2c3e8,I62cb5030, ...
Terry Parker [Wed, 13 May 2020 20:34:23 +0000 (16:34 -0400)]
Merge changes I39783eee,I874503ec,Ic942a8e4,I6ec2c3e8,I62cb5030, ...

* changes:
  PackBitmapIndex: Set distance threshold
  PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex
  PackBitmapIndex: Remove convertedBitmaps in the Remapper
  PackBitmapIndex: Reduce memory usage in GC
  PackBitmapIndex: Add AddToBitmapWithCacheFilter class
  PackBitmapIndex: Add util methods and builder to BitmapCommit
  PackBitmapIndex: Move BitmapCommit to a top-level class
  Refactor: Make retriveCompressed an method of the Bitmap class

4 years agoPackBitmapIndex: Set distance threshold 82/161782/5
Yunjie Li [Wed, 29 Apr 2020 22:27:47 +0000 (15:27 -0700)]
PackBitmapIndex: Set distance threshold

Setting the distance threshold to 2000 in PackWriterBitmapPreparer to
reduce memory usage in garbage collection. When the threshold is 0, GC
for the msm repository would use about 37 GB memory to complete. After
setting it to 2000, GC can finish in 75 min with about 10 GB memory.

Change-Id: I39783eeecbae58261c883735499e61ee1cac75fe
Signed-off-by: Yunjie Li <yunjieli@google.com>
4 years agoPackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex 56/161456/8
Yunjie Li [Thu, 23 Apr 2020 22:12:15 +0000 (15:12 -0700)]
PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex

Currently we're buffering the inflated bitmap entry in BasePackBitmapIndex
to optimize running time. However, this will use lots of memory during
the construction of the pack bitmap index file which may cause failure of
garbage collection.

The running time didn't increase significantly, if there's any increase,
after removing the buffering here. The report about usage of time/memory
will come in the next commit.

Change-Id: I874503ecc85714acab7ca62a6a7968c2dc0b56b3
Signed-off-by: Yunjie Li <yunjieli@google.com>
4 years agoPackBitmapIndex: Remove convertedBitmaps in the Remapper 55/161455/8
Yunjie Li [Thu, 23 Apr 2020 22:11:14 +0000 (15:11 -0700)]
PackBitmapIndex: Remove convertedBitmaps in the Remapper

The convertedBitmaps serves for time-optimization purpose. But it's
actually not saving time much but using lots of memory. So remove the
field here to save memory.

Currently the remapper class is only used in the construction of the
bitmap index file. And during the preparation of the file, we're only
getting bitmaps from the remapper when finding objects accessible from
a commit, so bitmap associated with each commit will only be fetched once
and thus the convertedBitmaps would hardly be read, which means that it's
not saving time.

Change-Id: Ic942a8e485135fb177ec21d09282d08ca6646fdb
Signed-off-by: Yunjie Li <yunjieli@google.com>