Commit Graph

73 Commits

Author SHA1 Message Date
Jonathan Tan 49beb5ae51 CommitGraphWriter: write changed-path filters
Add support for writing the BIDX and BDAT chunks of the commit graph
file, as described in man gitformat-commit-graph(5). The ability to read
such chunks will be added in a subsequent commit.

This work is based on earlier work by Kyle Zhao
(Ib863782af209f26381e3ca0a2c119b99e84b679c).

Change-Id: Ic18e6f0eeec7da1e1ff31751aabda5e6952dbe6e
Signed-off-by: kylezhao <kylezhao@tencent.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2023-07-18 14:21:48 -07:00
David Ostrovsky bf3298478a Bazel: Format build files with buildifier
Change-Id: I1ff38237058d11a3f61acc881c504382ff4b7e08
2022-01-20 00:54:01 -05:00
Thomas Wolf f7662a756e Merge branch 'stable-5.13' into stable-6.0
* stable-5.13:
  Use slf4j-simple instead of log4j for logging
  Update orbit to R20211213173813

Change-Id: I219ef3901c1d908b91bf9c8f00431b22686ff7a5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2022-01-05 15:59:09 +01:00
Matthias Sohn 486afbc08d Use slf4j-simple instead of log4j for logging
JGit uses slf4j-api as logging API.

The libraries
- org.eclipse.jgit.http.test
- org.eclipse.jgit.pgm
- org.eclipse.jgit.ssh.apache.test
- org.eclipse.jgit.test
used the outdated log4j 1.2.15 which is EOL since years.

Since both jgit command line and also the tests don't need sophisticated
logging features replace log4j with the much simpler slf4j-simple log
implementation. The org.slf4j.binding.simple 1.7.30 archive has only
25kB instead of 429kB for log4j 1.2.15

Applications using jgit are free to choose any other log implementation
supporting slf4j API.

Change-Id: I89e85cd3c76e954c3434622510975ce65dc227d4
2021-12-31 01:09:52 +01:00
Thomas Wolf 634302d2da sshd: add support for ssh-agent
Add a simple SSH agent connector using JNA. Include com.sum.jna and
com.sun.jna.platform in the target platform.

JNA is used to communicate through Unix domain sockets with ssh-agent,
and if on Windows, to communicate via shared memory with Pageant.

The new bundle o.e.j.ssh.apache.agent is an OSGi fragment so that
the java.util.ServiceLoader can find the provided factory without
further ado in OSGi environments.

Adapt both maven and bazel builds to include the new bundle.

Manually tested on OS X, CentOS 7, and Win10 with Pageant 0.76. Tested
by installing JGit built from this change into freshly downloaded
Eclipse 2021-12 M1, and then doing git fetches via SSH with different
~/.ssh/config settings (explicit IdentityFile, without any but a key in
the agent, with no keys and a key in the agent and IdentitiesOnly=yes
(must fail)).

Bug: 541274
Bug: 541275
Change-Id: I34e85467293707dbad1eb44d1f40fc2e70ba3622
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-11-03 23:46:54 +01:00
Matthias Sohn 8089c8b39c bazel: don't expose jsch and jzlib to org.eclipse.jgit
These libraries are no longer used by org.eclipse.jgit since the code
depending on them was moved to org.eclipse.jgit.ssh.jsch.

Change-Id: Ic1c66e8ca06d904abf44d84154bbe9a770aa94d5
2021-07-16 23:47:30 +02:00
Matthias Sohn 02344254ea Update orbit to I20210713220109
update
- org.apache.commons.compress to 1.20.0.v20210713-192
- org.bouncycastle.bcpg to 1.69.0.v20210713-1924
- org.bouncycastle.bcpkix to 1.69.0.v20210713-1924
- org.bouncycastle.bcprov to 1.69.0.v20210713-1924

- add org.bouncycastle.bcutil 1.69.0.v20210713-1924

In bazel build don't expose bouncycastle to org.eclipse.jgit since it's
not used there anymore since code depending on bouncycastle was moved to
org.eclipse.jgit.gpg.bc.

CQ: 21771
CQ: 23471
CQ: 23472
CQ: 23473
CQ: 23474
Change-Id: Id3d94c00c39bbc57e3f49a61150841249dc3985c
2021-07-16 23:47:30 +02:00
Matthias Sohn e0ba98edd2 Update orbit to I20210711110031
and update
- assertj to 3.20.2.v20210706-1104
- hamcrest to 2.2.0.v20210711-0821
  - classes which were in org.hamcrest.core 1.3 and org.hamcrest.library
    1.3 were all moved to org.hamcrest in 2.2
  - the annotation org.hamcrest.Factory was removed and is no longer
    needed
  - junit 4.13 requires hamcrest-core and hamcrest-library 1.3 therefore
    keep them in the target platform

CQ: 23501
Change-Id: Ife871c0343b611be9203aed7f86577e85bbf5c95
2021-07-16 23:47:29 +02:00
David Ostrovsky f8eefdb003 Bazel: Format build file with buildifier
Change-Id: I4c0c7ffb04d7bed517faf1a4932d8c76738bff11
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2021-03-27 15:00:28 +01:00
Thomas Wolf 64cbea8a97 GPG: compute the keygrip to find a secret key
The gpg-agent stores secret keys in individual files in the secret
key directory private-keys-v1.d. The files have the key's keygrip
(in upper case) as name and extension ".key".

A keygrip is a SHA1 hash over the parameters of the public key. By
computing this keygrip, we can pre-compute the expected file name and
then check only that one file instead of having to iterate over all
keys stored in that directory.

This file naming scheme is actually an implementation detail of
gpg-agent. It is unlikely to change, though. The keygrip itself is
computed via libgcrypt and will remain stable according to the GPG
main author.[1]

Add an implementation for calculating the keygrip and include tests.
Do not iterate over files in BouncyCastleGpgKeyLocator but only check
the single file identified by the keygrip.

Ideally upstream BouncyCastle would provide such a getKeyGrip() method.
But as it re-builds GPG and libgcrypt internals, it's doubtful it would
be included there, and since BouncyCastle even lacks a number of curve
OIDs for ed25519/curve25519 and uses the short-Weierstrass parameters
instead of the more common Montgomery parameters, including it there
might be quite a bit of work.

[1] http://gnupg.10057.n7.nabble.com/GnuPG-2-1-x-and-2-2-x-keyring-formats-tp54146p54154.html

Bug: 547536
Change-Id: I30022a0e7b33b1bf35aec1222f84591f0c30ddfd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-02-16 00:37:01 +01:00
Matthias Sohn 4120d17b0b Add org.eclipse.jetty.util.ajax to target platform and bazel deps
It is required by org.eclipse.jetty.servlet [1].

[1] https://search.maven.org/artifact/org.eclipse.jetty/jetty-servlet/9.4.35.v20201120/jar

Change-Id: I307ec8bad17f3a703bf25cc16c87ab9b524a84ff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-01-12 10:14:42 +01:00
Matthias Sohn 8d2d683655 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>
2020-06-01 01:46:59 +02:00
Matthias Sohn 77848d635b 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>
2020-06-01 01:26:22 +02:00
Matthias Sohn 8ada9048c5 Replace ExpectedException which was deprecated in junit 4.13
Change-Id: I64b0c057dd0a12aef2f3d56fa0c8a10e3b23fffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-01-24 15:46:08 +09:00
David Pursehouse e9d728ceb7 Merge branch 'stable-5.5'
* stable-5.5:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie32c3bae056fb0745892e6c20ad37d4994542d96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-11-26 17:44:56 +09:00
David Pursehouse 3c78d6237f Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: I21878c42fd9abf7d858b534300df0fffe4bad431
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-11-26 17:43:24 +09:00
David Pursehouse 839359425d Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie5e66f2e26c057c81101b0d110f91ea479eb362d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-11-26 17:42:14 +09:00
David Pursehouse da06f23c92 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ic1dc84a6c4a1cf430d329627642583fd6e0d0eaa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-11-26 17:41:10 +09:00
David Pursehouse 2c5ed560c9 Bazel: Add missing newlines at end of BUILD files
Change-Id: I11afc45141da988e28382898246995f6b45eb09c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-11-26 08:43:10 +01:00
Matthias Sohn abecc9587f Merge branch 'stable-5.5'
* stable-5.5:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: If87a13d0f809d9968ad2921b786f4b18e1b494d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-05 16:31:58 +01:00
Matthias Sohn e85664e3f8 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: Ib735c4039e24ec8b045ae2cc81df1e9e5c9fa996
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-05 15:54:48 +01:00
Matthias Sohn cbdb5e7750 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Update API problem filters
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: I00615958ab6fbdff601e87a9792aba5606cda12a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-05 15:25:08 +01:00
Matthias Sohn 29a429c29a Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Run JMH benchmarks using bazel
  Benchmark for creating files and FileSnapshots
  Implement benchmark for looking up FileStore of a given Path
  JMH benchmark for SimpleLruCache
  Remove unused API problem filters
  Silence API errors for new API added since 5.1.0

Change-Id: If91c55a192d3b2c441d9c8d414f2e24a7261b1b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-05 15:18:45 +01:00
Matthias Sohn 452c38cd22 Run JMH benchmarks using bazel
The benchmarks can be built and run using bazel by running:

$ bazel run //org.eclipse.jgit.benchmarks:benchmarks

Change-Id: I6679750eaa0f2be30ed9d45036e013b0ea4fcc86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-11-05 14:59:50 +01:00
Luca Milanesio 3b5a4416aa Rename servlet-api-3_1 to match Gerrit master
JGit is built from source on Gerrit-CI: the Bazel build
dependencies need to be aligned. On Gerrit master the servlet-api-3_1
is renamed to servlet-api (see [1]): do the same on the JGit master
branch.

In addition, removing the version suffix from dependency rule makes
it much easier to upgrade. The actual reason the for the renaming it
in Gerrit core is upgrade attempt to servlet-api 4.0, done in [2].

[1] https://gerrit-review.googlesource.com/c/gerrit/+/238496
[2] https://gerrit-review.googlesource.com/c/gerrit/+/238383

Change-Id: I63c506da335deef54eb279879e897b427200797b
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-10-01 14:11:43 -04:00
Matthias Sohn 80fd4cb075 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iaea77a89fcd821df5dbb24f5e3e39e6d1dfc0bd4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 15:05:19 +02:00
Matthias Sohn 82badd0a87 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: I0d8b7f79177a20dc00c89e2cf0005eb3d3039532
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 11:17:32 +02:00
David Pursehouse 1fd09a19a2 Bazel: Format BUILD files with buildifier
Change-Id: I8b4abf67fba592be42b2b5b029fa0e972d746dcb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-08 10:09:07 +09:00
Matthias Sohn 38198972d4 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iea37a8e39e9d4872dc607c9222dcf191ce4e4757
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-07 12:16:42 +02:00
David Pursehouse 4678710c68 Format lib/BUILD with buildifier
Change-Id: I4f0ad64371b160b67797f49b9fde521e5dea9396
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 15:36:11 +09:00
David Pursehouse 85cea8c583 Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
Change-Id: I24746335db132bf20f400cb3db400737596d4542
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 15:36:11 +09:00
Matthias Sohn 35d99477b8 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Fix NPE in RebaseTodoFile#parseComments
  Fix NPE in ObjectIdOwnerMap#get
  Fix NPE in CommitOnlyTest#getHead
  FileUtils#lastModifiedInstant should not log error if path doesn't exist
  Cache user global and system-wide git configurations
  Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock
  Add missing dependencies for running FS_POSIXTest in Eclipse
  Fix javadoc for SystemReader#getInstance
  Improve retry handling when saving FileStoreAttributes fails
  Ensure FSTest uses MockSystemReader
  Make supportsAtomicCreateNewFile return true as default
  Update orbit to R20190602212107-2019-06 to enable backports from master
  Handle InvalidPathException in FS_POSIX#createNewFileAtomic
  Ensure root cause of lock creation failures is logged
  Implement toString in MockSystemReader and MockConfig
  LocalDiskRefTreeDatabaseTest shall use MockSystemReader
  Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader
  Ensure we use MockSystemReader in tests
  Override FileBasedConfig's save method in MockConfig
  Remove FileBasedConfig.load(boolean) introduced in d45219ba
  Disable debug log for FS in org.eclipse.jgit.test
  Bazel: enable logging for tests in org.eclipse.jgit.test
  LockFile: log exception if creation of lock file failed
  Stop using deprecated Constants.CHARACTER_ENCODING

Change-Id: I43c2ab8b44c3e87d48e4072907ad169c81e3ffe0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-20 00:10:15 +02:00
Matthias Sohn 18fb58ae05 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Fix NPE in RebaseTodoFile#parseComments
  Fix NPE in ObjectIdOwnerMap#get
  Fix NPE in CommitOnlyTest#getHead
  FileUtils#lastModifiedInstant should not log error if path doesn't exist
  Cache user global and system-wide git configurations
  Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock
  Add missing dependencies for running FS_POSIXTest in Eclipse
  Fix javadoc for SystemReader#getInstance
  Improve retry handling when saving FileStoreAttributes fails
  Ensure FSTest uses MockSystemReader
  Make supportsAtomicCreateNewFile return true as default
  Update orbit to R20190602212107-2019-06 to enable backports from master
  Handle InvalidPathException in FS_POSIX#createNewFileAtomic
  Ensure root cause of lock creation failures is logged
  Implement toString in MockSystemReader and MockConfig
  LocalDiskRefTreeDatabaseTest shall use MockSystemReader
  Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader
  Ensure we use MockSystemReader in tests
  Override FileBasedConfig's save method in MockConfig
  Remove FileBasedConfig.load(boolean) introduced in d45219ba
  Disable debug log for FS in org.eclipse.jgit.test
  Bazel: enable logging for tests in org.eclipse.jgit.test
  LockFile: log exception if creation of lock file failed
  Stop using deprecated Constants.CHARACTER_ENCODING

Change-Id: If0c5010a2cf151ebebb2f2088fac3ee02c5007b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-19 23:41:17 +02:00
Matthias Sohn 0eea7368e2 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Fix NPE in RebaseTodoFile#parseComments
  Fix NPE in ObjectIdOwnerMap#get
  Fix NPE in CommitOnlyTest#getHead
  FileUtils#lastModifiedInstant should not log error if path doesn't exist
  Cache user global and system-wide git configurations
  Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock
  Add missing dependencies for running FS_POSIXTest in Eclipse
  Fix javadoc for SystemReader#getInstance
  Improve retry handling when saving FileStoreAttributes fails
  Ensure FSTest uses MockSystemReader
  Make supportsAtomicCreateNewFile return true as default
  Update orbit to R20190602212107-2019-06 to enable backports from master
  Handle InvalidPathException in FS_POSIX#createNewFileAtomic
  Ensure root cause of lock creation failures is logged
  Implement toString in MockSystemReader and MockConfig
  LocalDiskRefTreeDatabaseTest shall use MockSystemReader
  Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader
  Ensure we use MockSystemReader in tests
  Override FileBasedConfig's save method in MockConfig
  Remove FileBasedConfig.load(boolean) introduced in d45219ba
  Disable debug log for FS in org.eclipse.jgit.test
  Bazel: enable logging for tests in org.eclipse.jgit.test
  LockFile: log exception if creation of lock file failed
  Stop using deprecated Constants.CHARACTER_ENCODING

Change-Id: I48c585f3c9287be7d6ddb6b01a1955444e13fa31
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-19 18:30:35 +02:00
Matthias Sohn 4d46a68abe Update orbit to R20190602212107-2019-06 to enable backports from master
update
- org.apache.httpcomponents.httpclient to 4.5.6.v20190503-0009
- org.apache.httpcomponents.httpcore to 4.4.10.v20190123-2214
- com.jcraft.jsch" version to 0.1.55.v20190404-1902
- org.mockito to 2.23.0.v20190527-1420
  add its dependencies
    - net.bytebuddy.byte-buddy 1.9.0.v20181107-1410
    - net.bytebuddy.byte-buddy-agent 1.9.0.v20181106-1534
- org.objenesis to 2.6.0.v20180420-1519

CQ: 18303 (objenesis)
CQ: 18703 (httpclient)
CQ: 18704 (httpcore)
CQ: 19588 (jsch)
CQ: 20214 (mockito)
CQ: 20215 (butebuddy)
CQ: 20216 (bytebuddy-agent)
Change-Id: I8d76375de867e32b7818449f843b7c053a717b5e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-12 14:35:06 +02:00
Matthias Sohn f54db4a857 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Fix OpenSshConfigTest#config
  FileSnapshot: fix bug with timestamp thresholding
  In LockFile#waitForStatChange wait in units of file time resolution
  Cache FileStoreAttributeCache per directory
  Fix FileSnapshot#save(long) and FileSnapshot#save(Instant)
  Persist minimal racy threshold and allow manual configuration
  Measure minimum racy interval to auto-configure FileSnapshot
  Reuse FileUtils to recursively delete files created by tests
  Fix FileAttributeCache.toString()
  Add test for racy git detection in FileSnapshot
  Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times
  Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit
  Add missing javadoc in org.eclipse.jgit.junit
  Enhance RepeatRule to report number of failures at the end
  Fix FileSnapshotTests for filesystem with high timestamp resolution
  Retry deleting test files in FileBasedConfigTest
  Measure filesystem timestamp resolution already in test setup
  Refactor FileSnapshotTest to use NIO APIs
  Measure stored timestamp resolution instead of time to touch file
  Handle CancellationException in FileStoreAttributeCache
  Fix FileSnapshot#saveNoConfig
  Use Instant for smudge time in DirCache and DirCacheEntry
  Use Instant instead of milliseconds for filesystem timestamp handling
  Workaround SecurityException in FS#getFsTimestampResolution
  Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution
  FS: ignore AccessDeniedException when measuring timestamp resolution
  Add debug trace for FileSnapshot
  Use FileChannel.open to touch file and set mtime to now
  Persist filesystem timestamp resolution and allow manual configuration
  Increase bazel timeout for long running tests
  Bazel: Fix lint warning flagged by buildifier
  Update bazlets to latest version
  Bazel: Add missing dependencies for ArchiveCommandTest
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  Add support for nanoseconds and microseconds for Config#getTimeUnit
  Optionally measure filesystem timestamp resolution asynchronously
  Delete unused FileTreeIteratorWithTimeControl
  FileSnapshot#equals: consider UNKNOWN_SIZE
  Timeout measuring file timestamp resolution after 2 seconds
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8
  Fix non-deterministic hash of archives created by ArchiveCommand
  Update Maven plugins ecj, plexus, error-prone
  Update Maven plugins and cleanup Maven warnings
  Make inner classes static where possible
  Fix API problem filters

Change-Id: Iec3ad6ccc194582cb844310dc172c3103dae4457
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 13:24:14 +02:00
Matthias Sohn 718555518d Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Fix OpenSshConfigTest#config
  FileSnapshot: fix bug with timestamp thresholding
  In LockFile#waitForStatChange wait in units of file time resolution
  Cache FileStoreAttributeCache per directory
  Fix FileSnapshot#save(long) and FileSnapshot#save(Instant)
  Persist minimal racy threshold and allow manual configuration
  Measure minimum racy interval to auto-configure FileSnapshot
  Reuse FileUtils to recursively delete files created by tests
  Fix FileAttributeCache.toString()
  Add test for racy git detection in FileSnapshot
  Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times
  Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit
  Add missing javadoc in org.eclipse.jgit.junit
  Enhance RepeatRule to report number of failures at the end
  Fix FileSnapshotTests for filesystem with high timestamp resolution
  Retry deleting test files in FileBasedConfigTest
  Measure filesystem timestamp resolution already in test setup
  Refactor FileSnapshotTest to use NIO APIs
  Measure stored timestamp resolution instead of time to touch file
  Handle CancellationException in FileStoreAttributeCache
  Fix FileSnapshot#saveNoConfig
  Use Instant for smudge time in DirCache and DirCacheEntry
  Use Instant instead of milliseconds for filesystem timestamp handling
  Workaround SecurityException in FS#getFsTimestampResolution
  Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution
  FS: ignore AccessDeniedException when measuring timestamp resolution
  Add debug trace for FileSnapshot
  Use FileChannel.open to touch file and set mtime to now
  Persist filesystem timestamp resolution and allow manual configuration
  Increase bazel timeout for long running tests
  Bazel: Fix lint warning flagged by buildifier
  Update bazlets to latest version
  Bazel: Add missing dependencies for ArchiveCommandTest
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  Add support for nanoseconds and microseconds for Config#getTimeUnit
  Optionally measure filesystem timestamp resolution asynchronously
  Delete unused FileTreeIteratorWithTimeControl
  FileSnapshot#equals: consider UNKNOWN_SIZE
  Timeout measuring file timestamp resolution after 2 seconds
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Deprecate Constants.CHARACTER_ENCODING in favor of
StandardCharsets.UTF_8
  Fix non-deterministic hash of archives created by ArchiveCommand
  Update Maven plugins ecj, plexus, error-prone
  Update Maven plugins and cleanup Maven warnings
  Make inner classes static where possible
  Fix API problem filters

Change-Id: I238adfd3080a5fed9d64c3c757297da6ea893918
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 13:04:38 +02:00
Matthias Sohn 0046b2a8fe Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Fix OpenSshConfigTest#config
  FileSnapshot: fix bug with timestamp thresholding
  In LockFile#waitForStatChange wait in units of file time resolution
  Cache FileStoreAttributeCache per directory
  Fix FileSnapshot#save(long) and FileSnapshot#save(Instant)
  Persist minimal racy threshold and allow manual configuration
  Measure minimum racy interval to auto-configure FileSnapshot
  Reuse FileUtils to recursively delete files created by tests
  Fix FileAttributeCache.toString()
  Add test for racy git detection in FileSnapshot
  Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times
  Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit
  Add missing javadoc in org.eclipse.jgit.junit
  Enhance RepeatRule to report number of failures at the end
  Fix FileSnapshotTests for filesystem with high timestamp resolution
  Retry deleting test files in FileBasedConfigTest
  Measure filesystem timestamp resolution already in test setup
  Refactor FileSnapshotTest to use NIO APIs
  Measure stored timestamp resolution instead of time to touch file
  Handle CancellationException in FileStoreAttributeCache
  Fix FileSnapshot#saveNoConfig
  Use Instant for smudge time in DirCache and DirCacheEntry
  Use Instant instead of milliseconds for filesystem timestamp handling
  Workaround SecurityException in FS#getFsTimestampResolution
  Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution
  FS: ignore AccessDeniedException when measuring timestamp resolution
  Add debug trace for FileSnapshot
  Use FileChannel.open to touch file and set mtime to now
  Persist filesystem timestamp resolution and allow manual configuration
  Increase bazel timeout for long running tests
  Bazel: Fix lint warning flagged by buildifier
  Update bazlets to latest version
  Bazel: Add missing dependencies for ArchiveCommandTest
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  Add support for nanoseconds and microseconds for Config#getTimeUnit
  Optionally measure filesystem timestamp resolution asynchronously
  Delete unused FileTreeIteratorWithTimeControl
  FileSnapshot#equals: consider UNKNOWN_SIZE
  Timeout measuring file timestamp resolution after 2 seconds
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8
  Fix non-deterministic hash of archives created by ArchiveCommand
  Update Maven plugins ecj, plexus, error-prone
  Update Maven plugins and cleanup Maven warnings
  Make inner classes static where possible
  Fix API problem filters

Change-Id: Ia57385b2a60f48a5317c8d723721c235d7043a84
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-08 11:54:56 +02:00
David Pursehouse 0aa8eca5f1 Bazel: Add missing dependencies for ArchiveCommandTest
Dependencies on commons-compress, xz, and jgit-archive are required
for the build to succeed.

Change-Id: I42f3721078a240ad93b8dcab909e66b9bfff0b56
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-07-16 12:10:31 +09:00
David Ostrovsky 5e4be72b5a Bazel: Simplify names of bouncy castle libraries
Name bouncy castle libraries consistently. This also allows to use
local jgit tree as dependency in gerrit.

Change-Id: Ie0a995a70ecee907d25b3cdda9034a25c0290efe
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2019-05-16 19:04:40 +02:00
Thomas Wolf 86cee68e0d Apache MINA sshd client: adapt to sshd 2.2.0
Update target platforms, maven and bazel builds to use sshd 2.2.0.

Adapt internal classes to changed sshd interfaces and remove previous
work-arounds for asking repeatedly for key passwords and for loading
keys lazily; both are now done by sshd.

CQ: 19034
CQ: 19035
Bug: 541425
Change-Id: I85e1df6ebb8a94953a912d9b2b8a7b5bdfbd608a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-06 15:22:05 +02:00
Medha Bhargav Prabhala 137e91a465 Implement signing commits using BouncyCastle
This also includes a change to generating the jgit CLI jar. Shading is
no longer possible because it breaks the signature of BouncyCastle.
Instead, the Spring Boot Loader Maven plug-in is now used to generate an
executable jar.

Bug: 382212
Change-Id: I35ee3d4b06d9d479475ab2e51b29bed49661bbdc
Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-16 10:05:10 +01:00
David Pursehouse f4d7c911fd Format lib/BUILD with buildifier
Change-Id: I63db70e6e6f4da44a211621d8721ede66bce44bd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-02 20:30:52 -05:00
Thomas Wolf db627c4177 Apache MINA sshd client: enable support for ed25519 keys
Include the net.i2p.crypto.eddsa bundle via a hard dependency.

Add tests for dealing with ed25519 host keys and user key files.

Manual tests: fetching from git.eclipse.org with an ed25519 user key,
and pushing this change itself using the same ed25519 key.

Note that sshd 2.0.0 does not yet support encrypted ed25519 private
keys.

Bug: 541272
Change-Id: I7072f4014d9eca755b4a2412e19c086235e5eae9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-12-02 11:43:13 +01:00
Matthias Sohn 2532fa74c2 Fix running tests from bazel
The new dependency to mockito for JDKHttpConnectionTest wasn't added for
bazel test run.

Change-Id: Ie967b7152340a0b3e05cced7eadfd40af78d9995
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 20:18:04 +01:00
Thomas Wolf 1316d43e51 Move SshTestGitServer to new bundle org.eclipse.jgit.junit.ssh
Create the bundle and move the SshTestGitServer there. Verified that
the Eclipse build still works and ran JSchSshTest and ApacheSshTest as
junit tests inside Eclipse.

Update maven build and features to account for that. Verified by
running full maven build including packaging.

Update bazel build files to account for that. Verified by a
clean-slate bazel build :all, followed by running the JSchSshTest
and the ApacheSshTest via bazel.

Change-Id: Ia084942f4425b454529de148e00417e7da786a90
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-17 07:28:08 -08:00
David Pursehouse f4c0189f25 Format BUILD files with buildifier
Change-Id: I7eb83e0560b1826c4f8567e9bc5fbdb2ae3fe9d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-13 18:33:41 -08:00
Thomas Wolf 488d95571f Apache MINA sshd client
Add a new ssh client implementation based on Apach MINA sshd 2.0.0.

This implementation uses JGit's own config file parser and host entry
resolver. Code inspection of the Apache MINA implementation revealed
a few bugs or idiosyncrasies that immediately would re-introduce bugs
already fixed in the past in JGit.

Apache MINA sshd is not without quirks either, and I had to configure
and override more than I had expected. But at least it was all doable
in clean ways.

Apache MINA boasts support for Bouncy Castle, so in theory this should
open the way to using more ssh key algorithms, such as ed25519.

The implementation is in a separate bundle and is still not used in
the core org.eclipse.jgit bundle. The tests re-use the ssh tests from
the core test bundle.

Bug: 520927
Change-Id: Ib35e73c35799140fe050d1ff4fb18d0d3596580e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-13 10:49:26 -08:00
Thomas Wolf 08b0a8632d Ssh tests with an Apache MINA sshd test git server
Add a simple ssh git server based on Apache MINA sshd, and use it
in new tests that verify ssh operations and in particular a number
of bugs that had cropped up over time in JSch.

The git server supports fetching only, and sftp access.

The tests are all in an abstract base class; the concrete JschSshTest
class only provides ssh-specific test setup. So the same tests could
be run easily also with some other ssh client.

Bug: 520927
Change-Id: Ide6687b717fb497a29fc83f22b07390a26dfce1d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-06 13:17:21 +01:00
Jonathan Nieder c33e392f9b pgm: Add missing dependency on commons-logging
Without this, commands like "jgit repo" that use commons-logging fail.

Change-Id: Ia78198c5e15ac4d6152d832ab2a2498f625486d2
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-01 18:25:22 -04:00