Commit Graph

8219 Commits

Author SHA1 Message Date
Christian Halstrick 88e924e86b Merge "Implement git describe --all" 2020-10-13 08:14:14 -04:00
Jason Yeo 276fcb2a11 Implement git describe --all
This enables jgit to use any refs in the refs/ namespace when describing
commits.

Signed-off-by: Jason Yeo <jasonyeo88@gmail.com>
Change-Id: I1fa22d1c39c0e2f5e4c2938c9751d8556494ac26
2020-10-13 18:06:39 +08:00
Alexa Panfil a0d3680f49 Compute time differences with Duration
Reason why this change is needed:
Currently the durations of fetch events are computed by
registering time instants with System.currentTimeMillis()
and calculating the differences with simple minus operation,
but multiple sources suggest that the best practice is to use
the Java 8 Duration and Instant objects.

What this patch does:
Get time measurements with Instant.now() instead of
System.currentTimeMillis() and calculate the duration of fetch
events (Reachability checks and Negotiation) using
Duration.between().toMillis().

Signed-off-by: Alexa Panfil <alexapizza@google.com>
Change-Id: I573a0a0562070083cf5a5a196d9710f69a7fa587
2020-10-09 18:55:20 +00:00
Thomas Wolf f37aa182e1 Override config http.userAgent from environment GIT_HTTP_USER_AGENT
According to [1], environment variable GIT_HTTP_USER_AGENT can
override a git config http.userAgent.

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

Change-Id: I996789dc49faf96339cd7b4e0a682b9bcafb6f70
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-10-06 19:03:36 -04:00
Marco Miller b0b3250197 Upgrade spotbugs-maven-plugin to 4.1.3
Since 4.0.4, aligns with spotbugs 4.1.3 [1]. Also, "fixes copy of repo
being put until target" and "reduces logging output below threshold".

[1] https://github.com/spotbugs/spotbugs-maven-plugin/releases

Change-Id: Idb7127ba7b5fc40bf85a13bb193760bbf6ec0f7c
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-10-06 08:37:34 -04:00
David Ostrovsky f3bb71206c Fix OperatorPrecedence warning flagged by error prone
Building with Bazel is failing with this error message:

HttpSupport.java:480: error: [OperatorPrecedence] Use grouping
parenthesis to make the operator precedence explicit
    if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') {
                             ^
    (see https://errorprone.info/bugpattern/OperatorPrecedence)
Did you mean 'if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {'?

Change-Id: I96089d3158d06ba981cfdf2b03865261b328de23
2020-10-02 18:52:10 +02:00
Matthias Sohn dcc6c8a261 UploadPackTest#testUploadRedundantBytes: ensure test repo is closed
This fixes a resource leak warning.

Change-Id: I65166eeefc719ea577963c84ce2059e2d7e6c1d7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-10-02 01:18:18 +02:00
Matthias Sohn 7fbc0e02a0 ObjectDirectory#selectObjectRepresentation: fix formatting
Change-Id: I3872f3001bb11e29a526ed90184ccb0c991b8567
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-10-02 00:55:04 +02:00
Marco Miller 8887a6779a Upgrade ecj to 3.23.0
Change-Id: Ifca682c4aff0cfcd827986a02580e70dcfcad5c0
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-27 04:42:53 -04:00
James Wynn 2171f868d9 Support "http.userAgent" and "http.extraHeader" from the git config
Validate the extra headers and log but otherwise ignore invalid
headers. An empty http.extraHeader starts the list afresh.

The http.userAgent is restricted to printable 7-bit ASCII, other
characters are replaced by '.'.

Moves a support method from the ssh.apache bundle to HttpSupport in
the main JGit bundle.

Bug:541500
Change-Id: Id2d8df12914e2cdbd936ff00dc824d8f871bd580
Signed-off-by: James Wynn <james@jameswynn.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-26 23:42:38 +02:00
Thomas Wolf 3459239dfc sshd: better error report when user cancels authentication
Use a dedicated exception class to be able to detect this case in the
SshdSessionFactory and skip the generic SshException in that case.

Change-Id: I2a0bacf47bae82f154a0f4e79efbb2af2a17d0cf
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-26 23:34:02 +02:00
Thomas Wolf e21d7b2d3c API filters for PackStatistics.Accumulator
Change-Id: Iaafb766aa76f0e8f837bd37c0729b1262e7ac1f6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-26 19:56:46 +02:00
Thomas Wolf 6f41458d8a Add TypedConfigGetter.getPath()
This enables EGit to override with a lenient variant that logs the
problem and continues with the default value. EGit needs this because
otherwise a corrupt core.excludesFile entry can render the whole UI
unusable (until the git config is fixed) because any use of the
WorkingTreeIterator will throw an InvalidPathException.

This is not a problem on OS X, where all characters are allowed in
file names. But on Windows some characters are forbidden... see bug
567296. The message of the InvalidPathException is not helpful since
it doesn't point to the origin of the problem. EGit can log a much
better message indicating the offending config file and entry in the
Eclipse error log, where the user can see it.

Bug: 567309
Change-Id: I4e57afa715ff3aaa52cd04b5733f69e53af5b1e0
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-25 18:40:10 -04:00
Alexa Panfil 597a6bc7ec Make Javadoc consistent for PackStatistics fields
Change-Id: I53d4072174e9fec92bff7c0225aa7470d8d39d05
2020-09-24 19:41:55 +00:00
Alexa Panfil 3c5e159eae Measure time taken for reachability checks
Reason why this change is needed:
Getting this metric will help estimate how much time will be saved once
the reachability checks get optimized

What this patch does:
Measure time spent by requestValidator.checkWants() in parseWants() and save
it in an instance of PackStatistics.Accumulator.

Signed-off-by: Alexa Panfil <alexapizza@google.com>
Change-Id: Id7fe4016f96549d9511a2c24052dad93cfbb31a4
2020-09-24 12:32:02 +00:00
Terry Parker be403859c1 Merge "Measure time taken for negotiation in protocol V2" 2020-09-22 11:34:24 -04:00
Alexa Panfil c3458a6e03 Measure time taken for negotiation in protocol V2
Reason why this change is needed:
Getting this metric will help estimate how much time is spent
on negotiation in fetch V2.

What this patch does:
Measure time spent on negotiation rounds in UploadPack.fetchV2()
and save it in an instance of PackStatistics.Accumulator.
This is the same way the statistics are already gathered for
protocol V0/V1.

Change-Id: I14e55dd6ff743cb0b21b4953b533269ef069abb1
2020-09-22 10:05:03 +00:00
Thomas Wolf cb553e3583 IndexDiffFilter: handle path prefixes correctly
When comparing git directory paths to check whether one is a prefix
of another, one must add a slash to avoid false prefix matches when
one directory name is a prefix of another. The path "audio" is not
a prefix of the path "audio-new", but would be a prefix of a path
"audio/new".

Bug: 566799
Change-Id: I6f671ca043c7c2c6044eb05a71dc8cca8d0ee040
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-21 16:52:43 -04:00
Thomas Wolf 566e49d7d3 sshd: support the ProxyJump ssh config
This is useful to access git repositories behind a bastion server
(jump host).

Add a constant for the config; rewrite the whole connection initiation
to parse the value and (recursively) set up the chain of hops. Add
tests for a single hop and two different ways to configure a two-hop
chain.

The connection timeout applies to each hop in the chain individually.

Change-Id: Idd25af95aa2ec5367404587e4e530b0663c03665
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-19 15:17:00 -04:00
Marco Miller 020dc586a6 Upgrade jacoco-maven-plugin to 0.8.6
Change-Id: Ifd4e8fc60844690d144a0872db4f740f45226ff9
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-16 08:34:59 -04:00
Terry Parker 292919b12a Merge "ReceivePackStats: Add size and count of unnecessary pushed objects" 2020-09-14 09:53:43 -04:00
Yunjie Li 58e991b5de ReceivePackStats: Add size and count of unnecessary pushed objects
Since there is no negotiation for a push, the client is probably sending
redundant objects and bytes which already exist in the server.

Add more metrics in the stats to quantify it. Duplicated size and number
to measure the size and the number of duplicated objects which should
not be pushed.

Change-Id: Iaacd4761ee9366a0a7ec4e26c508eff45c8744de
Signed-off-by: Yunjie Li <yunjieli@google.com>
2020-09-11 16:19:57 -07:00
Matthias Sohn 8cd49885ba Merge branch 'stable-5.9' into master
* stable-5.9:
  Prepare 5.9.1-SNAPSHOT builds
  JGit v5.9.0.202009080501-r
  [releng] Enable japicmp for the fragments added in 5.8.0
  GitlinkMergeTest: fix boxing warnings
  Remove unused API problem filters
  Add missing since tag on BundleWriter#addObjectsAsIs
  GPG: include signer's user ID in the signature

Change-Id: Iaa96f9228752540f446fc232a49f31a738fd8d30
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-09 00:14:08 +02:00
Marco Miller aabd3d5ed1 Upgrade maven-project-info-reports-plugin to 3.1.1
Change-Id: I1a3c68e8ebab79e1a23616d1f56f75981c56a7f3
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-08 14:56:37 -04:00
Matthias Sohn ed9992896a Prepare 5.9.1-SNAPSHOT builds
Change-Id: I9006e7961111982943ffef496d15bd525959b3e4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-08 17:45:20 +02:00
Matthias Sohn dd169769bf JGit v5.9.0.202009080501-r
Change-Id: Ic98ae61b3f327ef72256fd9b2e28510e3a481de7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-08 13:01:43 +02:00
Thomas Wolf e70b48bbd2 [releng] Enable japicmp for the fragments added in 5.8.0
Uncomment the japicmp configurations in the pom.xmls of the fragments
org.eclipse.jgit.gpg.bc and org.eclipse.jgit.ssh.jsch.

Change-Id: I7c884be014cb48387f97a300043b04aeb712fbba
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-07 23:44:43 +02:00
Matthias Sohn f33702dd29 GitlinkMergeTest: fix boxing warnings
Change-Id: I4bdf1ab3e7d7e9d96318e2b16b792aa98ebd2ecd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-05 23:28:06 +02:00
Matthias Sohn 8bb172acdb Remove unused API problem filters
Change-Id: Ice154340e3377e89dc51d40587c8a4c5caec2bcf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-05 23:25:58 +02:00
Matthias Sohn 94aab2f634 Add missing since tag on BundleWriter#addObjectsAsIs
Change-Id: Ia07c0ede31e280831869db77b70b43874d8ba3ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-05 23:25:02 +02:00
Matthias Sohn daddfe051b Merge branch 'master' into stable-5.9
* master:
  SshdSession: close channel gracefully
  jgit: Add DfsBundleWriter
  Prepare 5.10.0-SNAPSHOT builds
  ResolveMerger: do not content-merge gitlinks on del/mod conflicts
  ResolveMerger: Adding test cases for GITLINK deletion
  ResolveMerger: choose OURS on gitlink when ignoreConflicts
  ResolveMerger: improving content merge readability
  ResolveMerger: extracting createGitLinksMergeResult method
  ResolveMerger: Adding test cases for GITLINK merge

Back out the version change to 5.10.0-SNAPSHOT which was done on master
already.

Change-Id: I1a6b1f0b8f5773be47823d74f593d13b16a601d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-05 22:51:34 +02:00
Thomas Wolf d9b0601d3a SshdSession: close channel gracefully
Close the channel gracefully to give the server a chance to clean up
properly on its side.

Bug: 565854
Change-Id: Iedda5af3b97c8321f08f7ce854274cbb30e401de
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-05 15:24:20 -04:00
Thomas Wolf 38015e3d36 GPG: include signer's user ID in the signature
Signing a commit with command line git and gpg 2.2.20 includes the
e-mail part of the key's user ID as a "Signer's User ID" subpacket
on the signature.

Implement this for signing via Bouncy Castle.

Bug: 564386
Change-Id: I68906b895349359596cf3451d65f2840c60df856
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-09-05 21:03:38 +02:00
Marco Miller d5d8b7a8ba Merge branch 'stable-5.9'
* stable-5.9:
  Bump Bazel version to 3.5.0

Change-Id: Ic96a2918c34696d31af5104305201e8426989a9d
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-04 12:07:03 -04:00
Masaya Suzuki 9d2055152c jgit: Add DfsBundleWriter
DfsBundleWriter writes out the entire repository to a Git bundle file.
It packs all objects included in the packfile by concatenating all pack
files. This makes the bundle creation fast and cheap. Useful for backing
up a repository as-is.

Change-Id: Iee20e4b1ab45b2a178dde8c72093c0dd83f04805
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2020-09-03 22:58:37 +00:00
Terry Parker 957419610a Merge changes from topic "fix_ui"
* changes:
  ResolveMerger: do not content-merge gitlinks on del/mod conflicts
  ResolveMerger: Adding test cases for GITLINK deletion
  ResolveMerger: choose OURS on gitlink when ignoreConflicts
  ResolveMerger: improving content merge readability
  ResolveMerger: extracting createGitLinksMergeResult method
  ResolveMerger: Adding test cases for GITLINK merge
2020-09-03 18:35:24 -04:00
Marco Miller 920442ff42 Bump Bazel version to 3.5.0
This latest release includes cherry picks, a new feature and some
important changes [1].

[1] https://github.com/bazelbuild/bazel/releases/tag/3.5.0

Change-Id: Ie6966b0b56a351f98cb20b25daf3412740e68562
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-03 13:54:24 -04:00
Marco Miller df6a1c55fa Merge branch 'stable-5.9'
* stable-5.9:
  Upgrade maven-resources-plugin to 3.2.0
  Upgrade plexus-compiler version to 2.8.8
  [bazel] Add missing dependency to slf4j-api
  [errorprone] DirCacheEntry: make clear operator precedence
  [errorprone] PackWriter#parallelDeltaSearch: avoid suppressed exception
  [errorprone] Declare DirCache#version final
  Add jgit-4.17-staging target platform for 2020-09
  Update target platform to R20200831200620

Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Change-Id: I2e2f41cf6ebbcb45b8978b519db3f1c8f7afb5f4
2020-09-02 16:50:05 -04:00
Matthias Sohn 14d5a7497f Merge changes Ib0b2dc7c,I827da397 into stable-5.9
* changes:
  Upgrade maven-resources-plugin to 3.2.0
  Upgrade plexus-compiler version to 2.8.8
2020-09-02 07:58:47 -04:00
Marco Miller 68fbd7817c Upgrade maven-resources-plugin to 3.2.0
Change-Id: Ib0b2dc7c5b781dbc4ce26782c508b8c7e11641ed
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-01 14:40:47 -04:00
Marco Miller 2704707749 Upgrade plexus-compiler version to 2.8.8
Change-Id: I827da3973f489b03f9321b065dfb96ad7c29e270
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-09-01 14:40:47 -04:00
Matthias Sohn 8b589b3bf2 [bazel] Add missing dependency to slf4j-api
Change-Id: I8a6b0cc8892ff4ba83d0f4a0d5801b1de27401f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 17:51:45 +02:00
Matthias Sohn 50e81a52c0 [errorprone] DirCacheEntry: make clear operator precedence
See https://errorprone.info/bugpattern/OperatorPrecedence

Change-Id: I96f2c844a7b3d9d5605122118d9420bde31ec2f0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 17:51:45 +02:00
Matthias Sohn 1d95f9cb8f [errorprone] PackWriter#parallelDeltaSearch: avoid suppressed exception
See https://errorprone.info/bugpattern/Finally

Change-Id: Ic2ad0d1e1ba7552b5a5c6238f83c0e13a94254d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 17:51:45 +02:00
Matthias Sohn 04622016ea [errorprone] Declare DirCache#version final
Enums values should be immutable, see
https://errorprone.info/bugpattern/ImmutableEnumChecker.

Change-Id: Ib0a358d3a5f1560ca73ec3153ca8088fe7a35eb6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 17:51:44 +02:00
Matthias Sohn b51ed023ff Add jgit-4.17-staging target platform for 2020-09
Change-Id: Ic3d3f7d1a4d13b40426675d29d8c521f1437f845
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 01:22:15 +02:00
Matthias Sohn 812c3969e6 Update target platform to R20200831200620
and update to new Orbit version of the following libraries
- org.apache.commons.codec to 1.14.0.v20200818-1422
- org.apache.httpcomponents.httpclient to 4.5.10.v20200830-2311
- org.bouncycastle.bcpg [1.65.0.v20200527-1955
- org.bouncycastle.bcpkix [1.65.0.v20200527-1955
- org.bouncycastle.bcprov [1.65.1.v20200529-1514

Fix minor issues in target platforms and rename 4.16-staging to 4.16
since that version was released already.

Change-Id: Ifea2600e445e783807a5d94ea23ac3c6550956b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-09-01 01:08:26 +02:00
Matthias Sohn 6ae1a30004 Prepare 5.10.0-SNAPSHOT builds
Change-Id: I9a2b39e9e85f27179ceb3b1709d75c466089a3bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-08-27 16:14:36 +02:00
Matthias Sohn 223fd29673 Merge branch 'stable-5.9' into master
* stable-5.9:
  Prepare 5.9.0-SNAPSHOT builds
  JGit v5.9.0.202008260805-m3

Change-Id: I2fdd289a14cebea02125711bd47a2cb9ad292b0d
2020-08-27 14:47:52 +02:00
Matthias Sohn a3d7240352 Prepare 5.9.0-SNAPSHOT builds
Change-Id: Ia3e8382ec503150979d8acb6161031ccfb7fd921
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-08-27 10:22:51 +02:00