Commit Graph

6559 Commits

Author SHA1 Message Date
Matthias Sohn 9e5c7c5358 Capture test coverage and add an aggregate test coverage report
Configure Maven build to capture test coverage using jacoco.

Add new org.eclipse.jgit.coverage Maven module to aggregate
jacoco test coverage results and generate test coverage HTML report at

org.eclipse.jgit.coverage/target/site/jacoco-aggregate/index.html

See https://www.eclemma.org/jacoco/trunk/doc/maven.html

Change-Id: Iaeec4033e448ebc16965c05ab54109c4155a307a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-21 20:43:07 -05:00
David Pursehouse ccc21c7d4a JGitInternalException: Fix typo in Javadoc
Change-Id: I46fabab3cb2d9164234ce04de346826687a3fa35
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-22 08:06:40 +09:00
Mincong HUANG d09388e156 Avoid double words
Change-Id: I0fdf595cba93f5a5cdd0496cee07ac91db304532
Signed-off-by: Mincong Huang <mincong.h@gmail.com>
2018-12-21 08:07:08 +01:00
Matthias Sohn 8f11539265 Silence API error for 3 digit version number in @since tag
Change-Id: I4943d9338ddf294e2ef67f0d459a3030f528d0c9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-21 01:30:30 +01:00
David Pursehouse e6b4ae2e14 Remove unnecessary @since tags from non-API classes
Change-Id: I6bed174c062a0785641dc8ad69151bf7e843cdcf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 20:02:31 +09:00
David Pursehouse 3e51a078d9 Merge branch 'stable-5.2'
* stable-5.2:
  BasePackConnection: Check for expected length of ref advertisement
  TransferConfig: Make constructors public
  Update last JGit version

Change-Id: I4406d4f68136a2ce363701324b9a842ad468bc59
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 15:55:02 +09:00
David Pursehouse 3cb80a433d Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  BasePackConnection: Check for expected length of ref advertisement
  TransferConfig: Make constructors public

Change-Id: I2480a0455250ee381fae93cac2db30f8305fa6aa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 14:02:19 +09:00
David Pursehouse f4fc6404ba BasePackConnection: Check for expected length of ref advertisement
When a server sends a ref advertisement using protocol v2 it contains
lines other than ref names and sha1s.  Attempting to get the sha1 out
of such a line using the substring method can result in a SIOOB error
when it doesn't actually contain the sha1 and ref name.

Add a check that the line is of the expected length, and subsequently
that the extracted object id is valid, and if not throw an exception.

Change-Id: Id92fe66ff8b6deb2cf987d81929f8d0602c399f4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 11:41:02 +09:00
David Pursehouse 2269669fb1 TransferConfig: Make constructors public
UploadPack has a setTransferConfig method which allows to set the
transfer config, however since the constructors of TransferConfig
have the default package visibility it is not possible for any
application using UploadPack, for example Gerrit, to actually set
a transfer config.

Make the constructors public. This is consistent with the public
constructors for example on PackConfig.

Change-Id: I07080255838421871403b2b2bcc294aa8f621c57
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 08:37:45 +09:00
David Pursehouse 209b1e1cb3 LfsGson: Remove unnecessary @since tag
The tag is formed inconsistently to tags in the rest of the JGit code
base (i.e. "4.10.0" with a trailing ".0" where all the others don't).

However since this class is not in the public API, the @since tag is
not necessary and can just be removed.

Change-Id: Ifa3f543f819a39453fcf343278e522b5d7b003c3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 08:33:43 +09:00
David Pursehouse 38d42d5ccd UploadPack: Rewrite setAdvertiseRefsHook to use ternary operator
This makes the implementation consistent with the other similar
methods in this class.

Change-Id: I007876aad883615d696c8eabc886818ae00b10ee
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-19 15:31:38 +09:00
David Pursehouse fc07fa26b9 UploadPack: Prevent setting null protocolV2Hook
The setProtocolV2Hook sets the protocolV2Hook to whatever value is
passed, which could be null, but the invocations of protocolV2Hook's
methods are not guarded by null-checks.

Annotate the parameter as @Nullable and set ProtocolV2Hook.DEFAULT
when null is passed. This makes the implementation consistent with
other similar methods that set a hook or filter with possible null
value.

Change-Id: I70919a3248d4c2658783941a37c47e437cff0baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-19 15:31:31 +09:00
David Pursehouse 3d203114bd UploadPack: Add @Nullable annotations
The class has several methods where passing a null parameter is
valid. Annotate those parameters as @Nullable.

Change-Id: Ie08893ee3ab34c1ffb2db875b4ab049ad065c697
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-19 15:31:25 +09:00
David Pursehouse d386943b83 Upgrade maven-jar-plugin to 3.1.1
Change-Id: I1b230fb558bc4773594a11292ee12820abe3ebaf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-16 16:05:48 -05:00
Michael Keppler 5ada6ede4d Upgrade Tycho to 1.3
With the upcoming Eclipse release 2018-12 a new version of Tycho has
been released. Upgrade the Tycho related build steps to the new version
in the Maven build.

Change-Id: Ifff186a9f97ed9faf70f15b20396724b0c9e801c
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-12-16 10:10:32 +01:00
Thomas Wolf 6608c1c30f Update last JGit version
The jgit-last-release-version is used by japicmp as baseline.

Change-Id: If56cc1785b61c92c9a05c8c29c6cb62001e89218
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-12-15 21:59:32 +01:00
Thomas Wolf e71e0068bc Enable japicmp for new SSH bundle; update its baseline
In the original contribution of this bundle, japicmp was disabled
as no previous version to compare against existed. Enable it now.

Update the version to compare against to 5.2.0.201812061821-r.

Change-Id: I42f812befde2d0d98db5f87e05230b51af244ae6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-12-15 20:37:39 +01:00
Matthias Sohn dac7ce0434 Merge branch 'stable-5.2'
* committer:
  Update list of committers
  Add new ssh bundles to Maven central scripts
  Update maven site reports
  Prepare 5.2.1-SNAPSHOT builds
  JGit v5.2.0.201812061821-r
  Update Orbit to R20181128170323 for 2018-12

Change-Id: I97c6ce5f0c963bfab4d45462f555563d9c5bbe8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-09 00:45:52 +01:00
Matthias Sohn 70b7c6382c Update list of committers
Change-Id: I5bd3dc06103f8f62af1485b92e7b89f8a725be28
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-09 00:24:25 +01:00
Matthias Sohn 5218d2f5da Add new ssh bundles to Maven central scripts
Change-Id: I5c41426f59a60af3da808f89be4e498c7ba2196e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-09 00:12:59 +01:00
Matthias Sohn 7a2fe0a7a9 Update maven site reports
- update name of reports which changed name in
  maven-project-info-reports-plugin 3.0.0
- add dependency-covergence report
- add dependency-management report
- add index report
- add summary report

Change-Id: I6d406ecd9e082d96b2bd250704d5ca18e7c8f735
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-09 00:12:59 +01:00
Matthias Sohn 57b8cf4261 Prepare 5.2.1-SNAPSHOT builds
Change-Id: I68d9f5b1c8ca8e8eada9143093dc4fa82519edd8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-07 01:46:38 +01:00
Matthias Sohn c84c08107d JGit v5.2.0.201812061821-r
Change-Id: I8528c913ad1a820ee9a2fa6be1c9125b518caefe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-07 00:20:43 +01:00
Matthias Sohn 1136834f02 Update Orbit to R20181128170323 for 2018-12
Change-Id: Ia3597d2d0609e5a0a67e5f2518f68ce99ab8aa3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-05 15:25:40 +01:00
Matthias Sohn 38da21d6b0 Prepare 5.3.0-SNAPSHOT builds
Change-Id: I8951c2cf650cc3e41d2baa0b330b94468cfed5c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-03 02:32:49 +01:00
Matthias Sohn 13afcf75fe Merge branch 'stable-5.2'
* stable-5.2:
  Format lib/BUILD with buildifier
  Update Orbit to S20181128170323 for 2018-12 RC1
  Include id_ed25519 in the known default identity files
  Apache MINA sshd client: enable support for ed25519 keys
  Prepare 5.2.0-SNAPSHOT builds
  Set git environment variables for hooks
  JGit v5.2.0.201811281532-m3

Change-Id: If96adcbf35ccf8d9f4da0f5d97491f502f5a72a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-03 02:32:16 +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
Matthias Sohn dbe6faffe6 Update Orbit to S20181128170323 for 2018-12 RC1
Change-Id: I4f66b907d8027cae779f54ef0bdc5d36b4a21f6f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-03 00:05:14 +01:00
Thomas Wolf 450b196627 Include id_ed25519 in the known default identity files
Change-Id: I9fb30c8fbb65536782ee73644c8990eb6661c660
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-12-02 16:35:12 +01: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
Thomas Wolf a08ffb0444 Merge "Set git environment variables for hooks" into stable-5.2 2018-12-02 05:34:18 -05:00
Michael Keppler 8ed9e489e0 Upgrade spotbugs-maven-plugin to 3.1.9
Change-Id: Idc447dfbcd165ef0362142bd17434d304c6c7f01
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-12-02 09:35:28 +01:00
Matthias Sohn 055c312bd1 Prepare 5.2.0-SNAPSHOT builds
Change-Id: I18646aaeee51047b234b758dcc1c2f89fd01b2f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-30 22:57:04 +01:00
Thomas Wolf 9c755c9e7c Set git environment variables for hooks
Set GIT_DIR and GIT_WORK_TREE when calling hooks.

Bug: 541622
Change-Id: I6153d8a6a934ec37a3a5e7319c2d0e516f539ab7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-30 00:37:03 +01:00
Matthias Sohn 12d840dfcb JGit v5.2.0.201811281532-m3
Change-Id: I79988b473d67e565d8f6bcac40ee9a14b26c9e60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 21:35:26 +01:00
Matthias Sohn ae805bd717 Update Apache commons compress to 1.18.0
to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] https://nvd.nist.gov/vuln/detail/CVE-2018-1324

CQ: 18320
Change-Id: I39b1d815e5b8e0208600afafe7a72bb603d04fb8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 20:18:04 +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
Matthias Sohn 4b3c87f639 Update Orbit to I20181128011035
to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] CVE-2018-1324

CQ: 18320
Change-Id: I01e435fda834bbb22892a1cfba411d0196d7de17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 16:43:44 +01:00
Matthias Sohn 065aab5131 Update bcprov-jdk15on used in tests to 1.59
CQ: 15889
Change-Id: I04c9099941dd1929cd9075ad6c89660a63e7de8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 09:54:06 -05:00
Christian Halstrick 158294f912 Merge "Fix IndexDiffs for git links" 2018-11-28 06:11:05 -05:00
David Pursehouse c5306b84ae Merge branch 'stable-5.1'
* stable-5.1:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I64d9b0099fc0d8449ec08f0b5653572b5c2f840f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 20:01:45 +09:00
David Pursehouse 9372cf496f Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 20:01:11 +09:00
David Pursehouse 28f0ef8509 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 19:51:01 +09:00
Matthias Sohn 7c798905ed Remove unused externalized text "submodulesNotSupported"
This text is unused since d72b9328.

Change-Id: I82e5652e205d7b238ff8adc21994029b828b09f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-27 03:48:09 -05:00
Thomas Wolf 4678f4b735 Fix IndexDiffs for git links
After cloning a repo with a submodule, non-recursively, JGit would
encounter in its TreeWalk in IndexDiff:

* first, a missing gitlink (in index & HEAD, not in working tree)
* second, the untracked folder (not in index and head, in working tree)

As a result, it would report the submodule as missing. Canonical git
reports a clean workspace.

The root cause of this is that the path of a gitlink "x" did
not compare equal to the path of a tree "x" in JGit.

Correct Paths.compare() to account for that. If two paths are otherwise
equal, then let gitlinks match both trees and files. Matching trees
solves the bug. Matching files is necessary to handle the case where
the gitlink directory was replaced by a file; see the new test case
IndexDiffSubmoduleTest.testSubmoduleReplacedByFile(). Comparisons of
unequal paths are left untouched, so the sort order is unchanged.

After the fix, another bug(?) in WorkingTreeIterator became apparent:
with core.dirNoGitLinks = true, it was no longer possible to overwrite
a gitlink in the index. This is now fixed in WorkingTreeIterator.

Add new test cases for the bug itself and for some related cases
(submodule directory deleted or replaced by a file) in
IndexDiffSubmoduleTest. Add a test for missing files in IndexDiffTest,
and adapt the PathsTest to test matching gitlinks.

Bug: 467631
Change-Id: I0549d10d46b1858e5eec3cc15095aa9f1d5f5280
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-26 20:53:42 +01:00
Matthias Sohn df6263644b Fix DescribeCommand with multiple match options
when multiple match options are given in git describe the result must
not depend on the order of the match options. JGit wrongly picked the
first match using the match options in the order they were defined. Fix
this by concatenating the streams of matching tags for all match options
and then choosing the first match on the concatenated stream sorted in
tie break order.

See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt

Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-26 18:49:30 +01:00
Matthias Sohn 3f745e40a1 Add a method to get all values of HTTP header defined as list
According to RFC 2616 [1] header field names are case insensitive.
Header fields defined as a comma separated list can have multiple header
fields with the same field name. Add a method to HttpConnection which
retrieves all values with a given header field name with the field name
compared case insensitive.

[1] https://tools.ietf.org/html/rfc2616#section-4.2"

Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-26 03:07:58 -05:00
Thomas Wolf f974c9c790 Undo treating blobs with NULs as a single line
This partially reverts commit a551b646: revert the changes in
RawParseUtils.lineMap(). Forcing all blobs containing a NUL byte
as a single line causes blame to produce useless results as soon
as it hits any version containing a NUL byte.

Doing binary detection at this level also has the problem that the
user cannot control it. Not by setting the text attribute nor in any
other way.

This came up in bug 541036, where a Java source inadvertently
contained NUL bytes in strings. Even fixing this by using escapes
"\000" will not fix JGit's blame for this file because the past
versions will still contain the NUL byte.

Native git can blame that file from bug 541036 fine.

Added new tests verifying that blaming a text file containing a NUL
byte produces sensible results.

Bug: 541036
Change-Id: I8991bec88e9827cc096868c6026ea1890b6d0d32
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-26 00:30:21 +01:00
Matthias Sohn 6f68ed2ed3 Update Ant to 1.10.5
CQ: 18322
Change-Id: I88982116e02598b0ac658c4d740d7a7c1e37280a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-22 01:15:31 +01:00
Matthias Sohn ae8533f1c4 Update Orbit to S20181120221132 for 2018-12
Change-Id: Ice169d000e4757732e847ba5e2ea5e59945a09e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-22 00:21:18 +01:00