Commit Graph

6487 Commits

Author SHA1 Message Date
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
Matthias Sohn dff99a272a 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>
2018-10-06 16:56:12 +02:00
Matthias Sohn 23ebbe5662 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>
2018-10-06 16:40:46 +02:00
Matthias Sohn 620370ab6a Prepare 4.11.5-SNAPSHOT builds
Change-Id: Ifbe76e14264e8b547930e2320e8e81d728bd6e38
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 14:17:48 +02:00
Matthias Sohn c2a866b109 JGit v4.11.4.201810060650-r
Change-Id: I5700ebd341b6b997a7757b17e7d731c4ce608ec2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 14:05:29 +02:00
Matthias Sohn 816bcd259e 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>
2018-10-06 11:00:17 +02:00
Matthias Sohn f07e48cc10 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>
2018-10-06 10:55:47 +02:00
Matthias Sohn f016e32471 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>
2018-10-06 02:26:05 +02:00
Matthias Sohn c0a973657f 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>
2018-10-06 01:52:38 +02:00
Matthias Sohn bf7a611dac Prepare 4.9.7-SNAPSHOT builds
Change-Id: I20e7bd6bdebcdb55a8c771314759bd8f98f04ef6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 01:32:40 +02:00
Matthias Sohn 73e6a93ba2 JGit v4.9.6.201810051924-r
Change-Id: Ib39aaae26da17aa37d654b24c1defd45126f4ea2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 01:24:42 +02:00
Matthias Sohn 7d94b446fe 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>
2018-10-06 01:16:08 +02:00
Matthias Sohn a8bd7dcc58 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>
2018-10-06 01:03:20 +02:00
Matthias Sohn 4a68f1a3c7 Prepare 4.7.6-SNAPSHOT builds
Change-Id: I99b59116999742d8d6cdba26287ea7c6eba11a30
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 00:36:30 +02:00
Matthias Sohn 9c90816cd9 JGit v4.7.5.201810051826-r
Change-Id: I60c7a2eff3dab5083f71df0d9465a4e94b5e2513
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-06 00:27:38 +02:00
Ivan Frade e4c28665b6 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>
2018-10-05 23:49:00 +02:00
Ivan Frade 3ed3eafbd1 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>
2018-10-05 21:45:54 +02:00
Ivan Frade db9f7b028d 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>
2018-10-05 21:38:22 +02:00
Matthias Sohn 9dbb18291f Revert "Configure WindowCache settings to use in JGit CLI"
This reverts commit e6375445d1.

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>
2018-10-05 11:09:27 +02:00
Thomas Wolf 569cf1856c 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>
2018-10-04 19:17:41 -04:00
Matthias Sohn abe43a5841 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>
2018-10-04 23:02:02 +02:00
Jonathan Nieder c33e392f9b pgm: Add missing dependency on commons-logging
Without this, commands like "jgit repo" that use commons-logging fail.

Change-Id: Ia78198c5e15ac4d6152d832ab2a2498f625486d2
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-01 18:25:22 -04:00
David Pursehouse 65d6bb073a 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>
2018-10-01 11:19:04 +09:00
David Pursehouse 731d638f69 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>
2018-10-01 11:16:05 +09:00
Jonathan Nieder 1f4ab45166 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>
2018-09-30 17:08:32 -07:00
David Pursehouse 7d19b18c7d TextBuiltin#init: Factor out a method to get the log output encoding
Change-Id: I87c5774722bd36ea6fe18c4b7ce22342578fa290
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 17:19:39 +09:00
David Pursehouse a5c0a8dfa5 ConfigConstants: Add constants for i18n.logOutputEncoding
Change-Id: I6073c7fc8ec30840e2ee2e90ac4cfdb136f48b9a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 17:14:50 +09:00
David Pursehouse d54fc955be 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>
2018-09-30 17:02:11 +09:00
David Pursehouse a97e79d95d Explicitly specify charset when constructing PrintWriter
Change-Id: Ie1631784b5eba04edb21f66df284f9e279fd2ec0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 16:59:34 +09:00
David Pursehouse 4316e1c3a9 TextBuiltin: Default to UTF-8 when i18n.logOutputEncoding is not set
Change-Id: I69d82086c052b7ba601e0daab133573ec37c25cf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 16:04:25 +09:00
David Pursehouse 74789e7786 SidebandInputStream: Specify charset when calling String.getBytes()
Change-Id: I96c3f6b2ef3db9619bb3ae46dfbf8bcff3c1cbca
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 14:34:14 +09:00
David Pursehouse b65a310abc 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>
2018-09-30 14:34:14 +09:00
David Pursehouse fbf6ce65ba Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8
Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-30 14:34:14 +09:00
David Pursehouse f5d7f93b52 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>
2018-09-30 14:34:14 +09:00
David Pursehouse 981e403e59 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>
2018-09-30 14:34:14 +09:00
David Pursehouse 0b292b9085 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>
2018-09-29 13:16:58 +09:00
David Pursehouse 302717c30b 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>
2018-09-29 13:02:26 +09:00
David Pursehouse f02844caae 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>
2018-09-29 12:59:03 +09:00
David Pursehouse 00698f9e27 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>
2018-09-29 12:54:37 +09:00