]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoMove protocol v0/v1 parsing to its own class and request objects 59/129459/18
Ivan Frade [Tue, 28 Aug 2018 20:57:52 +0000 (13:57 -0700)]
Move protocol v0/v1 parsing to its own class and request objects

Protocol v0/v1 parsing code doesn't have any real dependency on UploadPack.

Move it to its class and use a request object to read the data in
UploadPack.

This makes the code easier to test, keeps similar structure than protocol v2,
reduces the line count of UploadPack and paves the way to remove the
members as implicit parameters in it.

Change-Id: I8188da8bd77e90230a7e37c02d800ea18463694f
Signed-off-by: Ivan Frade <ifrade@google.com>
6 years agoMerge "Upgrade maven-surefire plugins to 2.22.1"
David Pursehouse [Sat, 13 Oct 2018 00:08:58 +0000 (20:08 -0400)]
Merge "Upgrade maven-surefire plugins to 2.22.1"

6 years agoFirstWant: tighten first-want line validation 20/130820/9
Ivan Frade [Thu, 11 Oct 2018 00:02:49 +0000 (17:02 -0700)]
FirstWant: tighten first-want line validation

First-want line parsing accepts lines with an optional whitespace, when
the spec is strict requiring a white space.

Validate the line enforcing that there is a white space between oid and
capabilities list.

Change-Id: I45ada67030e0720f9b402c298be18c7518c799b1
Signed-off-by: Ivan Frade <ifrade@google.com>
6 years agoMerge "Move first line parsing for v0/v1 pack negotiation out of UploadPack"
Jonathan Nieder [Fri, 12 Oct 2018 21:23:32 +0000 (17:23 -0400)]
Merge "Move first line parsing for v0/v1 pack negotiation out of UploadPack"

6 years agoMove first line parsing for v0/v1 pack negotiation out of UploadPack 90/129590/18
Ivan Frade [Mon, 17 Sep 2018 18:48:48 +0000 (11:48 -0700)]
Move first line parsing for v0/v1 pack negotiation out of UploadPack

In protocol v0/v1 pack negotiation, the first want line contains the
options the client wants in effect. This parsing is done in UploadPack
but it doesn't have any interaction with that class.

Move the code to its own class and package, mark the current one
as deprecated (it is public API) and add unit tests.

Take the chance to move the parsing code from the constructor to a
factory method, making the class a simple container of results.

Change-Id: I1757f535dda78a4111a1c12c3a3b455a4b6f0c51
Signed-off-by: Ivan Frade <ifrade@google.com>
6 years agoUpgrade maven-surefire plugins to 2.22.1 36/130836/1
David Pursehouse [Fri, 12 Oct 2018 09:55:38 +0000 (18:55 +0900)]
Upgrade maven-surefire plugins to 2.22.1

Change-Id: Ic53997223de82b8e0c4df96624889ffb9715822a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade error_prone_core to 2.3.2 94/130794/1
David Pursehouse [Thu, 11 Oct 2018 10:38:29 +0000 (19:38 +0900)]
Upgrade error_prone_core to 2.3.2

Change-Id: Icd9b08ad0c922e3e0a436f2a0a7fd60019ee22ae
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPackOutputStream: Suppress Error Prone's ShortCircuitBoolean warning 75/130275/4
David Pursehouse [Tue, 2 Oct 2018 04:06:24 +0000 (13:06 +0900)]
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>
6 years agoAdd missing @since tags for ObjectChecker.ErrorType 32/130732/1
Matthias Sohn [Wed, 10 Oct 2018 09:24:30 +0000 (11:24 +0200)]
Add missing @since tags for ObjectChecker.ErrorType

Change-Id: I4d0cd25d6cfaf8b81e58f35e58890ac580eaf9c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRevert "Remove unused API problem filters" 31/130731/1
Matthias Sohn [Wed, 10 Oct 2018 09:26:00 +0000 (11:26 +0200)]
Revert "Remove unused API problem filters"

This reverts commit 37c7fbd661085f28252580479129a996a9f3b0f1.

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

Change-Id: I5ce443d40b5f517be4a315479e81246d40af1983
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoBazel: Require minimum bazel version 0.17.1 18/130718/2
David Pursehouse [Wed, 10 Oct 2018 01:53:35 +0000 (10:53 +0900)]
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>
6 years agoMerge "ValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check"
David Pursehouse [Wed, 10 Oct 2018 02:07:14 +0000 (22:07 -0400)]
Merge "ValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check"

6 years agoRemove unused API problem filters 17/130717/2
David Pursehouse [Tue, 9 Oct 2018 23:57:03 +0000 (08:57 +0900)]
Remove unused API problem filters

Change-Id: I4fb1d2cf1cea92dd314edc776ddbaa6640c99cf1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check 77/130277/3
David Pursehouse [Tue, 2 Oct 2018 04:17:51 +0000 (13:17 +0900)]
ValidRefNameTest#testNormalizeBranchName: Fix string/ref equality check

Change-Id: Ibffb0dcaab6ec033b1b69aa27ccb7fdaa32fa925
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge changes from topic 'maven-plugin-updates'
David Pursehouse [Wed, 10 Oct 2018 00:22:27 +0000 (20:22 -0400)]
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

6 years agoFormat @NonNull on return value as method annotation 16/130716/1
Jonathan Nieder [Tue, 9 Oct 2018 22:56:55 +0000 (15:56 -0700)]
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>
6 years agoFormat @Nullable on return value as method annotation 15/130715/1
Jonathan Nieder [Tue, 9 Oct 2018 22:48:16 +0000 (15:48 -0700)]
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>
6 years agoAvoid using @Nullable to annotate arrays 14/130714/3
Jonathan Nieder [Tue, 9 Oct 2018 22:29:00 +0000 (15:29 -0700)]
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>
6 years agoFsckError: Use @Nullable as field annotation (before any modifier) 12/130712/1
Ivan Frade [Tue, 9 Oct 2018 21:38:15 +0000 (14:38 -0700)]
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>
6 years agoDfsFsck: Check that .gitmodules in the repository have valid contents 17/130517/8
Ivan Frade [Mon, 8 Oct 2018 22:42:47 +0000 (15:42 -0700)]
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>
6 years agoFsckError.CorruptObject: Use @Nullable constructor for errorType 56/130656/4
Ivan Frade [Mon, 8 Oct 2018 21:43:17 +0000 (14:43 -0700)]
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>
6 years agoSubmoduleValidator: Always throw SubmoduleValidationException 48/130648/5
Ivan Frade [Mon, 8 Oct 2018 20:37:42 +0000 (13:37 -0700)]
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>
6 years agoMerge branch 'stable-5.1' 55/130655/2
Jonathan Nieder [Mon, 8 Oct 2018 23:42:09 +0000 (23:42 +0000)]
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>
6 years agoMerge branch 'stable-5.0' into stable-5.1 54/130654/2
Jonathan Nieder [Mon, 8 Oct 2018 23:41:38 +0000 (23:41 +0000)]
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>
6 years agoMerge branch 'stable-4.11' into stable-5.0 53/130653/2
Jonathan Nieder [Mon, 8 Oct 2018 23:41:15 +0000 (23:41 +0000)]
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>
6 years agoMerge branch 'stable-4.10' into stable-4.11 52/130652/2
Jonathan Nieder [Mon, 8 Oct 2018 23:40:47 +0000 (23:40 +0000)]
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>
6 years agoMerge branch 'stable-4.9' into stable-4.10 51/130651/2
Jonathan Nieder [Mon, 8 Oct 2018 23:40:05 +0000 (23:40 +0000)]
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>
6 years agoMerge branch 'stable-4.8' into stable-4.9 64/130664/1
Jonathan Nieder [Mon, 8 Oct 2018 23:39:18 +0000 (23:39 +0000)]
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>
6 years agoMerge branch 'stable-4.7' into stable-4.8 63/130663/1
Jonathan Nieder [Mon, 8 Oct 2018 23:38:59 +0000 (23:38 +0000)]
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>
6 years agoSubmoduleValidator: Remove unused import of ConfigConstants 62/130662/1
David Pursehouse [Mon, 8 Oct 2018 23:29:26 +0000 (08:29 +0900)]
SubmoduleValidator: Remove unused import of ConfigConstants

Change-Id: I6afe5690bf9d1f1f4d414aa618daefc8b48d217e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 50/130650/1
Jonathan Nieder [Mon, 8 Oct 2018 21:49:24 +0000 (21:49 +0000)]
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>
6 years agoMerge branch 'stable-4.7' into stable-4.8 49/130649/1
Jonathan Nieder [Mon, 8 Oct 2018 21:49:09 +0000 (21:49 +0000)]
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>
6 years agoSubmoduleValidator: Permit missing path or url 76/130576/2
Jonathan Nieder [Sun, 7 Oct 2018 21:55:52 +0000 (21:55 +0000)]
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>
6 years agoRefAdvertiser: Add Javadoc for usage of send(Collection) 84/130584/1
Michael Keppler [Mon, 8 Oct 2018 06:45:11 +0000 (08:45 +0200)]
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>
6 years agoUpgrade wagon-ssh to 3.2.0 95/130395/3
David Pursehouse [Thu, 4 Oct 2018 11:18:23 +0000 (20:18 +0900)]
Upgrade wagon-ssh to 3.2.0

Change-Id: I8e268e516626b2eb2fcca5ec5cb83ea408401bb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade maven-jxr-plugin to 3.0.0 93/130393/3
David Pursehouse [Thu, 4 Oct 2018 11:04:42 +0000 (20:04 +0900)]
Upgrade maven-jxr-plugin to 3.0.0

Change-Id: Id85c6cfc27f8d0ae01f74bfdb675db58cb5d0410
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade maven-shade-plugin to 3.2.0 80/130380/3
David Pursehouse [Thu, 4 Oct 2018 02:08:45 +0000 (11:08 +0900)]
Upgrade maven-shade-plugin to 3.2.0

Change-Id: Iab1edce2f40aaa78729ded35cc0b94bed408069a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade jacoco-maven-plugin to 0.8.2 79/130379/3
David Pursehouse [Thu, 4 Oct 2018 02:05:41 +0000 (11:05 +0900)]
Upgrade jacoco-maven-plugin to 0.8.2

Change-Id: Icac28cdee81d8c6067dbd382695a8bd3999053e0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade maven-project-info-reports-plugin to 3.0.0 78/130378/3
David Pursehouse [Thu, 4 Oct 2018 02:02:36 +0000 (11:02 +0900)]
Upgrade maven-project-info-reports-plugin to 3.0.0

Change-Id: I316dcdb8dee192c33d272aa2a7ed860ef613b8a1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade maven-enforcer-plugin to 3.0.0-M2 77/130377/3
David Pursehouse [Thu, 4 Oct 2018 01:57:56 +0000 (10:57 +0900)]
Upgrade maven-enforcer-plugin to 3.0.0-M2

Change-Id: I9d5ce4a5432d5cbea2c915a84044d8ade3a7f48b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade maven surefire plugins to 2.22.0 76/130376/3
David Pursehouse [Thu, 4 Oct 2018 01:50:29 +0000 (10:50 +0900)]
Upgrade maven surefire plugins to 2.22.0

Change-Id: Iaf56c448d35042a60d6ce1cc5f4ed6a10a44aa3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEnsure same version of maven-surefire-plugin and maven-surefire-report-plugin 75/130375/3
David Pursehouse [Thu, 4 Oct 2018 01:43:31 +0000 (10:43 +0900)]
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>
6 years agoSubmoduleAddCommand: Remove double-check of submodule name 77/130577/2
Jonathan Nieder [Sun, 7 Oct 2018 21:59:35 +0000 (21:59 +0000)]
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>
6 years agoMerge branch 'stable-5.1' 79/130579/1
David Pursehouse [Mon, 8 Oct 2018 01:53:54 +0000 (10:53 +0900)]
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>
6 years agoUpdate API warning filter to 5.1.3 57/130557/1
Matthias Sohn [Sun, 7 Oct 2018 07:46:05 +0000 (09:46 +0200)]
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>
6 years agoMerge branch 'stable-5.1' 51/130551/1
Jonathan Nieder [Sun, 7 Oct 2018 03:46:37 +0000 (03:46 +0000)]
Merge branch 'stable-5.1'

* stable-5.1:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: I20f19666c2faccc68bfd5ea15582b534784a027a
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoMerge branch 'stable-5.0' into stable-5.1 50/130550/1
Jonathan Nieder [Sun, 7 Oct 2018 03:45:28 +0000 (03:45 +0000)]
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>
6 years agoMerge branch 'stable-4.11' into stable-5.0 49/130549/1
Jonathan Nieder [Sun, 7 Oct 2018 03:43:16 +0000 (03:43 +0000)]
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>
6 years agoMerge branch 'stable-4.10' into stable-4.11 48/130548/1
Jonathan Nieder [Sun, 7 Oct 2018 03:40:23 +0000 (03:40 +0000)]
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>
6 years agoMerge branch 'stable-4.9' into stable-4.10 47/130547/1
Jonathan Nieder [Sun, 7 Oct 2018 03:39:32 +0000 (03:39 +0000)]
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>
6 years agoMerge branch 'stable-4.8' into stable-4.9 46/130546/1
Jonathan Nieder [Sun, 7 Oct 2018 03:37:46 +0000 (03:37 +0000)]
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>
6 years agoMerge branch 'stable-4.7' into stable-4.8 45/130545/1
David Pursehouse [Sun, 7 Oct 2018 02:04:18 +0000 (11:04 +0900)]
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>
6 years agoObjectChecker#getGitsubmodules: Fix malformed javadoc 30/130530/2
David Pursehouse [Sat, 6 Oct 2018 08:51:28 +0000 (17:51 +0900)]
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>
6 years agoMerge branch 'stable-5.1' 01/130501/4
Matthias Sohn [Sat, 6 Oct 2018 17:14:35 +0000 (19:14 +0200)]
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>
6 years agoPrepare 5.1.3-SNAPSHOT builds 23/130523/2
Matthias Sohn [Sat, 6 Oct 2018 16:54:50 +0000 (18:54 +0200)]
Prepare 5.1.3-SNAPSHOT builds

Change-Id: I75c1a01885115fc709ab37f181234264c3f7423a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.1.2.201810061102-r 41/130541/1 v5.1.2.201810061102-r
Matthias Sohn [Sat, 6 Oct 2018 15:10:45 +0000 (17:10 +0200)]
JGit v5.1.2.201810061102-r

Change-Id: Id34e4ae12a796460862edc37c5eb072314199bf4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-5.0' into stable-5.1 00/130500/4
Matthias Sohn [Sat, 6 Oct 2018 14:56:12 +0000 (16:56 +0200)]
Merge branch 'stable-5.0' into stable-5.1

* stable-5.0:
  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

* Fix todos in SubmoduleAddTest

Change-Id: I53272081094b8948a40a1ce409af08b6ef330c1e
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 99/130499/4
Matthias Sohn [Sat, 6 Oct 2018 12:44:12 +0000 (14:44 +0200)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  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

* Fix configuration of maven-javadoc-plugin for site generation

Change-Id: Ic6ff8d324867ee41f15a5b890c7eee5092e8453e
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.11.5-SNAPSHOT builds 20/130520/2
Matthias Sohn [Sat, 6 Oct 2018 12:07:37 +0000 (14:07 +0200)]
Prepare 4.11.5-SNAPSHOT builds

Change-Id: Ifbe76e14264e8b547930e2320e8e81d728bd6e38
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.11.4.201810060650-r 19/130519/2 v4.11.4.201810060650-r
Matthias Sohn [Sat, 6 Oct 2018 10:50:29 +0000 (12:50 +0200)]
JGit v4.11.4.201810060650-r

Change-Id: I5700ebd341b6b997a7757b17e7d731c4ce608ec2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 35/130535/1
Matthias Sohn [Sat, 6 Oct 2018 09:00:09 +0000 (11:00 +0200)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Fix configuration of maven-javadoc-plugin

Change-Id: I80db074c45e840f15e227a400ef637b85084e711
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix configuration of maven-javadoc-plugin 31/130531/1
Matthias Sohn [Sat, 6 Oct 2018 08:55:47 +0000 (10:55 +0200)]
Fix configuration of maven-javadoc-plugin

Since maven-javadoc-plugin additionalJOption replaces additionalparam to
pass additional options to JavaDoc.

See https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#additionalJOption

Change-Id: Iddff5873520a181bcb9edf285b0c8db532e930ee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 98/130498/3
Matthias Sohn [Sat, 6 Oct 2018 00:25:17 +0000 (02:25 +0200)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  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

Change-Id: Ibd759f5d425f714e79b3137ff8e5b0f989933de0
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 97/130497/3
Matthias Sohn [Fri, 5 Oct 2018 23:52:38 +0000 (01:52 +0200)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  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

Change-Id: Ie59e34eb591a827d1ce8e483eec6d390a3c81702
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.9.7-SNAPSHOT builds 18/130518/1
Matthias Sohn [Fri, 5 Oct 2018 23:32:40 +0000 (01:32 +0200)]
Prepare 4.9.7-SNAPSHOT builds

Change-Id: I20e7bd6bdebcdb55a8c771314759bd8f98f04ef6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.9.6.201810051924-r 16/130516/1 v4.9.6.201810051924-r
Matthias Sohn [Fri, 5 Oct 2018 23:24:42 +0000 (01:24 +0200)]
JGit v4.9.6.201810051924-r

Change-Id: Ib39aaae26da17aa37d654b24c1defd45126f4ea2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 96/130496/3
Matthias Sohn [Fri, 5 Oct 2018 23:16:08 +0000 (01:16 +0200)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  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

Change-Id: Ia7a826399d8d5b8a0eb7169b40e98a6f5c207a4c
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 95/130495/3
Matthias Sohn [Fri, 5 Oct 2018 23:03:20 +0000 (01:03 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  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

Change-Id: Id6fabec4d0b682a7e20a46e88cbc05432efca062
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.7.6-SNAPSHOT builds 15/130515/1
Matthias Sohn [Fri, 5 Oct 2018 22:36:30 +0000 (00:36 +0200)]
Prepare 4.7.6-SNAPSHOT builds

Change-Id: I99b59116999742d8d6cdba26287ea7c6eba11a30
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.5.201810051826-r 14/130514/1 v4.7.5.201810051826-r
Matthias Sohn [Fri, 5 Oct 2018 22:27:38 +0000 (00:27 +0200)]
JGit v4.7.5.201810051826-r

Change-Id: I60c7a2eff3dab5083f71df0d9465a4e94b5e2513
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoBaseReceivePack: Validate incoming .gitmodules files 94/130494/6
Ivan Frade [Mon, 1 Oct 2018 20:44:00 +0000 (13:44 -0700)]
BaseReceivePack: Validate incoming .gitmodules files

The main concern are submodule urls starting with '-' that could pass as
options to an unguarded tool.

Pass through the parser the ids of blobs identified as .gitmodules
files in the ObjectChecker. Load the blobs and parse/validate them
in SubmoduleValidator.

Change-Id: Ia0cc32ce020d288f995bf7bc68041fda36be1963
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoObjectChecker: Report .gitmodules files found in the pack 93/130493/3
Ivan Frade [Thu, 27 Sep 2018 20:05:13 +0000 (13:05 -0700)]
ObjectChecker: Report .gitmodules files found in the pack

In order to validate .gitmodules files, we first need to find them
in the incoming pack.

Do it in the ObjectChecker stage. Check in the tree objects if they
point to a .gitmodules file and report the tree id and the .gitmodules
blob id.

This can be used later to check if the file is in the root of the
project and if the contents are good.

While we're here, make isMacHFSGit more accurate by detecting variants
of filenames that vary in case.

[jn: tweaked NTFS and HFS+ checking; added more tests]

Change-Id: I70802e7d2c1374116149de4f89836b9498f39582
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSubmoduleAddCommand: Reject submodule URIs that look like cli options 92/130492/3
Ivan Frade [Mon, 24 Sep 2018 23:03:35 +0000 (16:03 -0700)]
SubmoduleAddCommand: Reject submodule URIs that look like cli options

In C git versions before 2.19.1, the submodule is fetched by running
"git clone <uri> <path>". A URI starting with "-" would be interpreted
as an option, causing security problems. See CVE-2018-17456.

Refuse to add submodules with URIs, names or paths starting with "-",
that could be confused with command line arguments.

[jn: backported to JGit 4.7.y, bringing portions of Masaya Suzuki's
 dotdot check code in v5.1.0.201808281540-m3~57 (Add API to specify
 the submodule name, 2018-07-12) along for the ride]

Change-Id: I2607c3acc480b75ab2b13386fe2cac435839f017
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRevert "Configure WindowCache settings to use in JGit CLI" 48/130448/1
Matthias Sohn [Fri, 5 Oct 2018 09:04:53 +0000 (11:04 +0200)]
Revert "Configure WindowCache settings to use in JGit CLI"

This reverts commit e6375445d143d0335a9f5707e9bae1644cbef576.

Hard coding WindowCache settings wasn't a good idea, this prevents that
custom settings can be configured. Also using virtual memory mapping has
issues on Windows.

Bug: 539789
Change-Id: I37434581f9e3db2f1d7442d893f0dda0c2488d93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix handling of core.eol=native and of crlf attribute 22/127322/5
Thomas Wolf [Sun, 12 Aug 2018 12:27:21 +0000 (14:27 +0200)]
Fix handling of core.eol=native and of crlf attribute

EolStreamTypeUtil didn't handle these correctly on Windows.

Add three new tests to verify that the crlf attribute is handled as
described at [1], and that core.eol=native produces the expected
line endings on check-out.

[1] https://git-scm.com/docs/gitattributes

Bug: 497290
Change-Id: Idd9b435e3256c1e3251cc7b966f2f0460e787f07
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSilence API warning for method added to interface DepthWalk 37/130437/1
Matthias Sohn [Thu, 4 Oct 2018 21:02:02 +0000 (23:02 +0200)]
Silence API warning for method added to interface DepthWalk

Breaking implementers is ok in a minor version update following OSGi
semantic versioning. According to [1] adding a default method is ok if
risk of inheriting a method with the same name from multiple interfaces
is low.

[1] https://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_Interfaces

Change-Id: Iad354cb73cfff9a96b9a9852a3c4d9ba0c5df430
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agopgm: Add missing dependency on commons-logging 69/127369/2
Jonathan Nieder [Mon, 13 Aug 2018 23:57:04 +0000 (16:57 -0700)]
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>
6 years agoOverride int read(byte[], int, int) on test instances of InputStream 16/130216/1
David Pursehouse [Mon, 1 Oct 2018 02:18:45 +0000 (11:18 +0900)]
Override int read(byte[], int, int) on test instances of InputStream

This probably doesn't provide any benefit for the tests, but gets
rid of a warning from Error Prone.

See https://errorprone.info/bugpattern/InputStreamSlowMultibyteRead

Change-Id: I584d2e0d18475fad38747b688af6301c423f54a7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoLfsFactory#LfsInputStream: Override int read(byte[], int, int) 15/130215/1
David Pursehouse [Mon, 1 Oct 2018 02:16:05 +0000 (11:16 +0900)]
LfsFactory#LfsInputStream: Override int read(byte[], int, int)

According to Error Prone, the class should also override:

  int read(byte[], int, int)

otherwise multi-byte reads from this input stream are likely to be slow.

See https://errorprone.info/bugpattern/InputStreamSlowMultibyteRead

Change-Id: I33ab8cd30013447f2a0363b3a7b1424b79cb1818
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMergeFormatterPass: Remove constructor taking charset name as string 14/130214/1
Jonathan Nieder [Mon, 1 Oct 2018 00:08:32 +0000 (17:08 -0700)]
MergeFormatterPass: Remove constructor taking charset name as string

Since this constructor is package-private, so instead of deprecating
it, we can remove it right away.

Change-Id: I84ba72e8c94fb09412bbf7ce73b7eec72f61e964
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoTextBuiltin#init: Factor out a method to get the log output encoding 01/130201/1
David Pursehouse [Sun, 30 Sep 2018 08:19:39 +0000 (17:19 +0900)]
TextBuiltin#init: Factor out a method to get the log output encoding

Change-Id: I87c5774722bd36ea6fe18c4b7ce22342578fa290
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoConfigConstants: Add constants for i18n.logOutputEncoding 00/130200/1
David Pursehouse [Sun, 30 Sep 2018 08:14:50 +0000 (17:14 +0900)]
ConfigConstants: Add constants for i18n.logOutputEncoding

Change-Id: I6073c7fc8ec30840e2ee2e90ac4cfdb136f48b9a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBazel: Increase severity of DefaultCharset to ERROR 98/130198/1
David Pursehouse [Sun, 30 Sep 2018 08:02:11 +0000 (17:02 +0900)]
Bazel: Increase severity of DefaultCharset to ERROR

All existing instances of this issue have been fixed in preceding
commits. Increase its severity to ERROR so that it is easier to
detect reoccurences.

Change-Id: I50f95152857baac5ca44c15493f23b6f9cfac1bf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoExplicitly specify charset when constructing PrintWriter 97/130197/1
David Pursehouse [Sat, 29 Sep 2018 07:26:31 +0000 (16:26 +0900)]
Explicitly specify charset when constructing PrintWriter

Change-Id: Ie1631784b5eba04edb21f66df284f9e279fd2ec0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTextBuiltin: Default to UTF-8 when i18n.logOutputEncoding is not set 90/130190/3
David Pursehouse [Sat, 29 Sep 2018 06:45:12 +0000 (15:45 +0900)]
TextBuiltin: Default to UTF-8 when i18n.logOutputEncoding is not set

Change-Id: I69d82086c052b7ba601e0daab133573ec37c25cf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSidebandInputStream: Specify charset when calling String.getBytes() 89/130189/2
David Pursehouse [Sat, 29 Sep 2018 06:01:02 +0000 (15:01 +0900)]
SidebandInputStream: Specify charset when calling String.getBytes()

Change-Id: I96c3f6b2ef3db9619bb3ae46dfbf8bcff3c1cbca
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMergeFormatter{Pass}: Use Charset instead of String 88/130188/2
David Pursehouse [Sat, 29 Sep 2018 05:58:48 +0000 (14:58 +0900)]
MergeFormatter{Pass}: Use Charset instead of String

Deprecate constructors and methods taking a character set name as
a String, in favor of new variants taking a Charset.

Change-Id: I616c601daf232fa17610dba1087fd902030d46ea
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDeprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8 87/130187/2
David Pursehouse [Sat, 29 Sep 2018 05:39:56 +0000 (14:39 +0900)]
Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8

Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBazel: Increase severity of MissingFail to ERROR 86/130186/2
David Pursehouse [Sat, 29 Sep 2018 04:23:22 +0000 (13:23 +0900)]
Bazel: Increase severity of MissingFail to ERROR

All instances of this potential bug have been cleaned up in
preceding commits. Increase the severity to ERROR so that it
is easier to detect reoccurences.

Change-Id: I25beebcea1f01f468e0f2b1d24a83511029c077c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTestProtocolTest: Add missing calls to fail() 85/130185/2
David Pursehouse [Sat, 29 Sep 2018 04:20:02 +0000 (13:20 +0900)]
TestProtocolTest: Add missing calls to fail()

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: I58ad45a87dcf7d646dce056d20776d62faafbfef
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBlockListTest: Add missing calls to fail() 84/130184/1
David Pursehouse [Sat, 29 Sep 2018 04:16:58 +0000 (13:16 +0900)]
BlockListTest: Add missing calls to fail()

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: I518b524de7cd3802f03b80450cad02ab3f79d57b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDirCacheBuilderTest#testBuildRejectsUnsetFileMode: Add missing fail() 83/130183/1
David Pursehouse [Sat, 29 Sep 2018 04:02:26 +0000 (13:02 +0900)]
DirCacheBuilderTest#testBuildRejectsUnsetFileMode: Add missing fail()

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: Ic89f9daef3c31bfbfd1f3c003cb90a373cd74847
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDirCacheCheckoutTest#testCheckoutHierarchy: Add missing call to fail() 82/130182/1
David Pursehouse [Sat, 29 Sep 2018 03:59:03 +0000 (12:59 +0900)]
DirCacheCheckoutTest#testCheckoutHierarchy: Add missing call to fail()

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: I463510342bb6e6b99b31a0fe264d953340784393
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoConfigTest: Fix tests for getting empty config value as int 81/130181/1
David Pursehouse [Sat, 29 Sep 2018 03:54:37 +0000 (12:54 +0900)]
ConfigTest: Fix tests for getting empty config value as int

The tests were set up to expect an IllegalArgumentException when
the Config.getInt method was called with a section.key that has
not been set, or explicitly set to an empty string.

However, the IllegalArgumentException never gets thrown because
the getInt method returns the provided default ("1"), and because
there was no call to "fail" after getInt, the incorrect behavior
of the test was not noticed.

Remove the try/catch around getInt, and instead assert that the
expected default value is returned.

Found by Error Prone, which reported:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: Ie8e692aba9fb8523241fb8f298d57493923d9f78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileResolverTest#testNotAGitRepository: Fail when exception is not thrown 80/130180/2
David Pursehouse [Sat, 29 Sep 2018 03:45:20 +0000 (12:45 +0900)]
FileResolverTest#testNotAGitRepository: Fail when exception is not thrown

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: I9ac844aa6c5a620d9b5d21d2e242347b3788b96a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUploadPack: support deepen-since in protocol v2 85/129285/3
Jonathan Tan [Wed, 12 Sep 2018 19:32:27 +0000 (12:32 -0700)]
UploadPack: support deepen-since in protocol v2

Support the deepen-since parameter when requested by a client using
protocol v2. This is done by:
 - adding a DepthWalk.RevWalk#setDeepenSince method
 - updating DepthGenerator to recognize when deepen-since is set
 - recording in DepthWalk.Commit whether a commit is a boundary commit

Existing users of DepthWalk such as UploadPack previously recognized
boundary commits by comparing their depths against the threshold, not
tracking whether any parents were truly excluded. This behavior is
preserved - UploadPack considers a commit as boundary if its depth is
equal to the threshold *or* a parent was excluded (whether by depth or
by deepen-since).

Change-Id: I852bba6b1279f9cc8aee38282e9339d62b8dcddc
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoDepthGenerator: remove redundant depth check 84/129284/2
Jonathan Tan [Wed, 12 Sep 2018 19:49:40 +0000 (12:49 -0700)]
DepthGenerator: remove redundant depth check

In DepthGenerator, commits are always added to the "pending" queue
either at depth 0 (in the constructor) or after a depth check (in
next()), so it is redundant to check for depth after removing them from
the queue. Remove the check.

This redundancy seems to have been present since the introduction of
server-side shallow clone support in commit 9952223e06 ("Implement
server support for shallow clones", 2011-08-21).

Change-Id: Iad334935293367400c2901a25c0f4bf36c437cf2
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoFileRepositoryBuilderTest: Don't explicitly close BufferedWriter in try-with-resource 63/130063/1
David Pursehouse [Thu, 27 Sep 2018 09:01:03 +0000 (18:01 +0900)]
FileRepositoryBuilderTest: Don't explicitly close BufferedWriter in try-with-resource

The BufferedWriter is opened in a try-with-resource and thus will be
automatically closed.

Presumably the close was added to make sure it is closed before the
subsequent test statements are executed. Instead of explicitly closing
it, let the try-with-resource automatically close it, and move the
subsequent statements out of the try-block.

Change-Id: If5fada2f580ef9cbaad3a0b9216b5200b917781a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoExplicitly specify charset when constructing FileWriter 70/129970/1
David Pursehouse [Wed, 26 Sep 2018 04:31:39 +0000 (13:31 +0900)]
Explicitly specify charset when constructing FileWriter

Replace explicit construction of FileWriter with calls to the
utility method Files.newBufferedWriter, which allows to specify
the charset.

Also convert to try-with-resource.

Change-Id: I9fa3f612b9b2fc5ac12cd79d6e61ca181120dbf5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoExplicitly specify charset when constructing BufferedReader 69/129969/1
David Pursehouse [Wed, 26 Sep 2018 04:19:32 +0000 (13:19 +0900)]
Explicitly specify charset when constructing BufferedReader

Replace explicit construction of BufferedReader with calls to the
utility method Files.newBufferedReader, which allows to specify
the charset.

Change-Id: I61b9451dbc8d9cf83fc8a5981292b8fdc713ce37
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>