Commit Graph

6525 Commits

Author SHA1 Message Date
David Pursehouse b3adaf7741 PackOutputStream: Suppress Error Prone's ShortCircuitBoolean warning
The usage of non-short-circuit logic is intentional, per the inline
comment added in change Ib4b35e357 as a follow-up to Ie3761ffb4 which
was a previously rejected attempt to "fix" a similar warning that had
been raised by FindBugs.

Change-Id: I3f6729f954d45d30ce697356d2ab3cc877d3ad54
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-10 11:30:25 +02:00
Matthias Sohn 36536e3396 Add missing @since tags for ObjectChecker.ErrorType
Change-Id: I4d0cd25d6cfaf8b81e58f35e58890ac580eaf9c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-10 11:28:24 +02:00
Matthias Sohn de8de3bbd4 Revert "Remove unused API problem filters"
This reverts commit 37c7fbd661.

These filters weren't unused. Without them Eclipse raises 4 API errors.

Change-Id: I5ce443d40b5f517be4a315479e81246d40af1983
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-10 11:28:16 +02:00
David Pursehouse bcc327df3b Bazel: Require minimum bazel version 0.17.1
Check the bazel version using the checker from bazel_skylib, and
require at least version 0.17.1 which is the minimum version that
does not suffer from the Java API mismatch issue [1].

The implementation is borrowed from the Gerrit project.

[1] https://github.com/bazelbuild/bazel/issues/6027

Change-Id: I224250088a1f5072fcaa3ec81228f4d2cb8cb389
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-10 11:39:56 +09:00
David Pursehouse fbbb0b1e19 Merge "ValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check" 2018-10-09 22:07:14 -04:00
David Pursehouse 37c7fbd661 Remove unused API problem filters
Change-Id: I4fb1d2cf1cea92dd314edc776ddbaa6640c99cf1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-09 20:59:23 -04:00
David Pursehouse b0f2826dfd ValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check
Change-Id: Ibffb0dcaab6ec033b1b69aa27ccb7fdaa32fa925
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-10 09:53:04 +09:00
David Pursehouse db5cc027fd Merge changes from topic 'maven-plugin-updates'
* changes:
  Upgrade wagon-ssh to 3.2.0
  Upgrade maven-jxr-plugin to 3.0.0
  Upgrade maven-shade-plugin to 3.2.0
  Upgrade jacoco-maven-plugin to 0.8.2
  Upgrade maven-project-info-reports-plugin to 3.0.0
  Upgrade maven-enforcer-plugin to 3.0.0-M2
  Upgrade maven surefire plugins to 2.22.0
  Ensure same version of maven-surefire-plugin and maven-surefire-report-plugin
2018-10-09 20:22:27 -04:00
Jonathan Nieder b0991ca805 Format @NonNull on return value as method annotation
For example, instead of using

	public @NonNull String getMyFavoriteString() { ... }

use

	@NonNull
	public String getMyFavoriteString() { ... }

This makes the style more consistent (the existing JGit code base
tends to lean toward the second style) and makes the source code
better reflect how the annotation is parsed, as a METHOD annotation.

Longer term, we should switch to a TYPE_USE annotation and switch to
the first style.

Noticed using a style checker that follows
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations

Change-Id: I9b9fa08035d805ca660520f812a84d2f47eff507
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-09 15:56:55 -07:00
Jonathan Nieder 608b6b03b1 Format @Nullable on return value as method annotation
For example, instead of using

	public @Nullable String getMyFavoriteString() { ... }

use

	@Nullable
	public String getMyFavoriteString() { ... }

This makes the style more consistent (the existing JGit code base
tends to lean toward the second style) and makes the source code
better reflect how the annotation is parsed, as a METHOD annotation.

Longer term, we should switch to a TYPE_USE annotation and switch to
the first style.

Noticed using a style checker that follows
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations

Change-Id: I07f4e67cc149fb8007f696a4663e10d4bfc57e3a
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-09 15:52:54 -07:00
Jonathan Nieder c58362c174 Avoid using @Nullable to annotate arrays
As described in the javadoc for org.eclipse.jgit.annotations.Nullable:

  Warning: Please do not use this annotation on arrays. Different
  annotation processors treat `@Nullable Object[]` differently: some
  treat it as an array of nullable objects, for consistency with
  versions of `Nullable` defined with `@Target TYPE_USE`, while others
  treat it as a nullable array of objects. JGit therefore avoids using
  this annotation on arrays altogether.

  See the checker-framework manual[1] for details.

  [1] http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#faq-array-syntax-meaning

Change-Id: I14ffcf80adbb8145d797998de2f2fa6ab84c3ae3
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-09 15:52:54 -07:00
Ivan Frade 81b7f0e835 FsckError: Use @Nullable as field annotation (before any modifier)
More consistent with general coding style.

Change-Id: Idd0695c63d0b4a17640460e8c388ce12e952879a
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-09 14:43:08 -07:00
Ivan Frade 39b27f7c7b DfsFsck: Check that .gitmodules in the repository have valid contents
Previous commits block the addition to the repo of dangerous .gitmodules
files, but some could have been committed before those safeguards where
in place.

Add a check in DfsFsck to validate the .gitmodules files in the repo.
Use the same validation than the ReceivePack, translating the
results to FsckErrors.

Note that *all* .gitmodules files in the storage will be checked, not
only the latest version.

Change-Id: I040cf1f31a779419aad0292ba5e6e76eb7f32b66
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-09 13:48:47 -07:00
Ivan Frade 7aebb6779c FsckError.CorruptObject: Use @Nullable constructor for errorType
errorType is already null in the caller and callee when unknown, so we
can replace a conditional call to a setter in the only caller with an
unconditionally provided @Nullable constructor parameter.

As a bonus, this lets us mark the field as final.

Change-Id: Ie2f929180e74ffa1aba8ec6caccfa81fbd8bfc04
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-09 11:53:06 -07:00
Ivan Frade 9372791fcf SubmoduleValidator: Always throw SubmoduleValidationException
The fsck test needs more detail about the error than an IOException
with an explanatory message.

Add an error identifier to the SubmoduleValidatorException and make
it the only throwable exception when parsing a file.

Change-Id: Ic3f0955b497e1681b25e681e1282e876cdf3d2c5
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-09 11:52:57 -07:00
David Pursehouse 7eb34c175c Replace FindBugs with SpotBugs
SpotBugs [1] is the spiritual successor of FindBugs, carrying on from
the point where it left off with support of its community.

This is a backport of [1] which originally did the replacement on the
master branch. This change updates to the current latest version, so
that we can get the benefit of its checks when pushing changes to the
stable branches.

[1] https://spotbugs.github.io/
[2] https://git.eclipse.org/r/#/c/101312/

Change-Id: Ib73d56b5980b55f4d7e09d87abec3138cac3d3dc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-09 10:11:25 +09:00
Jonathan Nieder 18dce03a41 Merge branch 'stable-5.1'
* stable-5.1:
  SubmoduleValidator: Remove unused import of ConfigConstants
  SubmoduleValidator: Permit missing path or url

Change-Id: Ie0e35231c81a0c53c2051c4c123a5210b5a1c6d3
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:42:09 +00:00
Jonathan Nieder 6dd50d2e1b Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  SubmoduleValidator: Remove unused import of ConfigConstants
  SubmoduleValidator: Permit missing path or url

Change-Id: Iaa3160a1307777cc4233d82e50a57c63d75d141c
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:41:38 +00:00
Jonathan Nieder e63ca8d094 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  SubmoduleValidator: Remove unused import of ConfigConstants
  SubmoduleValidator: Permit missing path or url

Change-Id: Iaf3b994e763bd02054b820cd87fe68ff83675001
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:41:15 +00:00
Jonathan Nieder eb41de5b25 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  SubmoduleValidator: Remove unused import of ConfigConstants
  SubmoduleValidator: Permit missing path or url

Change-Id: Id74c837d6cb728439ccbd6ade71936b493c09e08
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:40:47 +00:00
Jonathan Nieder 8b239e5b75 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  SubmoduleValidator: Remove unused import of ConfigConstants
  SubmoduleValidator: Permit missing path or url

Change-Id: Ib3c311f1e8d2db95510292a72f2f49825ffce9d9
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:40:05 +00:00
Jonathan Nieder 9d91bf189e Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  SubmoduleValidator: Remove unused import of ConfigConstants

Change-Id: Id01fd9945e23a9343f96c42db89d5a1b302dad33
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:39:18 +00:00
Jonathan Nieder f282aaa137 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  SubmoduleValidator: Remove unused import of ConfigConstants

Change-Id: I6a7d19602d6d9099928ee52de727743b9717f262
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 23:38:59 +00:00
David Pursehouse 26e7a74601 SubmoduleValidator: Remove unused import of ConfigConstants
Change-Id: I6afe5690bf9d1f1f4d414aa618daefc8b48d217e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-09 08:29:26 +09:00
Jonathan Nieder 8ef8b71db9 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  SubmoduleValidator: Permit missing path or url

Change-Id: I989ac2c0c124c82385fc7cac7e0544ec225f7589
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 21:49:24 +00:00
Jonathan Nieder 830e0d6b8c Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  SubmoduleValidator: Permit missing path or url

Change-Id: I94fdaf45abbf7665f9eddc14b1a7f7144aafeadf
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 21:49:09 +00:00
Jonathan Nieder d3eaf1007b SubmoduleValidator: Permit missing path or url
A .gitmodules file can include a submodule without a path to configure
the URL for a submodule that is only present on other branches.

A .gitmodules file can include a submodule with no URL and no path to
reserve the name for a submodule that existed in earlier history but
is not available from any URL any more.

"git fsck" permits both of these cases.  Permit them in JGit as well
(instead of throwing NullPointerException).

Change-Id: I3b442639ad79ea7a59227f96406a12e62d3573ae
Reported-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-08 21:40:56 +00:00
Michael Keppler 03ccdb0782 RefAdvertiser: Add Javadoc for usage of send(Collection)
This was not updated with the original introduction of the new method.

Bug: 534731
Change-Id: Ic4589c3a209109a829fbb706a9bf38845134e904
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-10-08 08:45:11 +02:00
David Pursehouse 0527495db8 Upgrade wagon-ssh to 3.2.0
Change-Id: I8e268e516626b2eb2fcca5ec5cb83ea408401bb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 8eae450890 Upgrade maven-jxr-plugin to 3.0.0
Change-Id: Id85c6cfc27f8d0ae01f74bfdb675db58cb5d0410
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 49194e3608 Upgrade maven-shade-plugin to 3.2.0
Change-Id: Iab1edce2f40aaa78729ded35cc0b94bed408069a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 28de908ebe Upgrade jacoco-maven-plugin to 0.8.2
Change-Id: Icac28cdee81d8c6067dbd382695a8bd3999053e0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 1b56ee87ba Upgrade maven-project-info-reports-plugin to 3.0.0
Change-Id: I316dcdb8dee192c33d272aa2a7ed860ef613b8a1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse e2ab04e781 Upgrade maven-enforcer-plugin to 3.0.0-M2
Change-Id: I9d5ce4a5432d5cbea2c915a84044d8ade3a7f48b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 3ac9e790ad Upgrade maven surefire plugins to 2.22.0
Change-Id: Iaf56c448d35042a60d6ce1cc5f4ed6a10a44aa3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
David Pursehouse 8d040d6ba9 Ensure same version of maven-surefire-plugin and maven-surefire-report-plugin
The version of maven-surefire-report-plugin was controlled by a project
property, but the maven-surefire-plugin version was set explicitly.

Rename maven-surefire-report-plugin-version to maven-surefire-version,
and use the same property for both plugins' versions.

Change-Id: Ib2aea36f3db969cd038c071d0cd35f9056642518
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 13:51:47 +09:00
Jonathan Nieder 51d656586b SubmoduleAddCommand: Remove double-check of submodule name
Since v4.7.5.201810051826-r~3 (SubmoduleAddCommand: Reject submodule
URIs that look like cli options, 2018-09-24), SubmoduleAddCommand
checks submodule names for ".." path components in
assertValidSubmoduleName.  This additional check for the same is
redundant.

Change-Id: I993326a370978880b690dc133a81fa3025935bcb
Signed-off-by: Jonathan Nieder <jrn@gmail.com>
2018-10-07 22:14:02 -04:00
David Pursehouse 8309f5011e Merge branch 'stable-5.1'
* stable-5.1:
  Update API warning filter to 5.1.3

Change-Id: I5d88e41308dc3076e17463d949efdabcf602305a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-08 10:54:09 +09:00
Matthias Sohn 1bec897ada Update API warning filter to 5.1.3
We added API in 4.7.5 to fix CVE-2018-17456

Change-Id: I14698fb088de91b8ba8856e461f64138025a89fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-07 09:46:05 +02:00
Jonathan Nieder 7647b03e94 Merge branch 'stable-5.1'
* stable-5.1:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: I20f19666c2faccc68bfd5ea15582b534784a027a
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:46:37 +00:00
Jonathan Nieder c1ef0d2cfd Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: Ib32077c6640621670649fa4fbfcc8d0c9d8346f1
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:45:28 +00:00
Jonathan Nieder 3e73672c06 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: If82e40c5a39b84c6a63e8cc10d168696c4eb3e91
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:43:16 +00:00
Jonathan Nieder 735f79c663 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: Id2c8d1d4ffdf7bf18ef64479cfa1e959d9b2c37e
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:40:23 +00:00
Jonathan Nieder 112a19711d Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: I847bdb9ef2b9e733c79489577b8b6e852ce6abf3
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:39:32 +00:00
Jonathan Nieder acd35d5384 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: Ic73df5571e1ae86e5e026d0bf9d8e9e330cbfa97
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-07 03:38:26 +00:00
David Pursehouse f6eb785551 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: I51ddd8fa1c2fbcabfb010bc4662d2c925563b55a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-07 11:04:24 +09:00
David Pursehouse df8bd762a1 ObjectChecker#getGitsubmodules: Fix malformed javadoc
The text "<tree, blob>" with angle brackets should not be used in javadoc
since it is interpreted as an HTML tag and then rejected since it's not a
valid HTML tag. Wrap the text in a @literal tag.

Also add a missing space.

Change-Id: Ide045e8c04a39a916f5b2e964e58c151e4555830
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-07 09:20:31 +09:00
Matthias Sohn 1133faff8c Merge branch 'stable-5.1'
* stable-5.1:
  Prepare 5.1.3-SNAPSHOT builds
  JGit v5.1.2.201810061102-r
  Prepare 4.11.5-SNAPSHOT builds
  JGit v4.11.4.201810060650-r
  Fix configuration of maven-javadoc-plugin
  Prepare 4.9.7-SNAPSHOT builds
  JGit v4.9.6.201810051924-r
  Prepare 4.7.6-SNAPSHOT builds
  JGit v4.7.5.201810051826-r
  BaseReceivePack: Validate incoming .gitmodules files
  ObjectChecker: Report .gitmodules files found in the pack
  SubmoduleAddCommand: Reject submodule URIs that look like cli options
  Revert "Configure WindowCache settings to use in JGit CLI"

Change-Id: I833d30d6de75b097377872c000b2ef5a1b96cf89
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 19:28:51 +02:00
Matthias Sohn 2078b23cee Prepare 5.1.3-SNAPSHOT builds
Change-Id: I75c1a01885115fc709ab37f181234264c3f7423a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 18:54:50 +02:00
Matthias Sohn b63870200b JGit v5.1.2.201810061102-r
Change-Id: Id34e4ae12a796460862edc37c5eb072314199bf4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 17:10:45 +02:00