Commit Graph

5542 Commits

Author SHA1 Message Date
Matthias Sohn c4207c5fbe Fix javadoc in org.eclipse.jgit treewalk package
Change-Id: I1f9d9a005c7228c9881762a78228accad2c7a6d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-20 22:10:10 +01:00
Matthias Sohn 781e106a26 Fix javadoc in org.eclipse.jgit transport package
Change-Id: Id70e2c27e38bf12f87e66b28fbd0b06908494764
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-20 22:10:09 +01:00
Dave Borowitz c1a02f497a Merge branch 'stable-4.9'
* stable-4.9:
  PackInserter: Ensure objects are written at the end of the pack
  ObjectInserter: Add warning about mixing read-back with writes

Change-Id: I308e7c1c6b72e8d4d9b5d0f4f51e9815fc92d7d7
2017-12-20 14:39:11 -05:00
Dave Borowitz 43ef5dabf1 PackInserter: Ensure objects are written at the end of the pack
When interleaving reads and writes from an unflushed pack, we forgot to
reset the file pointer back to the end of the file before writing more
new objects. This had at least two unfortunate effects:
  * The pack data was potentially corrupt, since we could overwrite
    previous portions of the file willy-nilly.
  * The CountingOutputStream would report more bytes read than the size
    of the file, which stored the wrong PackedObjectInfo, which would
    cause EOFs during reading.

We already had a test in PackInserterTest which was supposed to catch
bugs like this, by interleaving reads and writes. Unfortunately, it
didn't catch the bug, since as an implementation detail we always read a
full buffer's worth of data from the file when inflating during
readback. If the size of the file was less than the offset of the object
we were reading back plus one buffer (8192 bytes), we would completely
accidentally end up back in the right place in the file.

So, add another test for this case where we read back a small object
positioned before a large object. Before the fix, this test exhibited
exactly the "Unexpected EOF" error reported at crbug.com/gerrit/7668.

Change-Id: I74f08f3d5d9046781d59e5bd7c84916ff8225c3b
2017-12-20 12:43:31 -05:00
Dave Borowitz f63ee965d4 ObjectInserter: Add warning about mixing read-back with writes
Change-Id: Ib0460d3c7df315d86f9adca5f66a8fd4c39e4060
2017-12-20 12:16:40 -05:00
Matthias Sohn 7f6aaa5768 Fix javadoc leftovers in org.eclipse.jgit api package
Change-Id: I2150889b5ed04e8739e2367fc9023b750b516398
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-20 08:51:16 +09:00
Matthias Sohn 1c35379100 Remove unused imports
Change-Id: I35370c66e54d93d9b0aa3995e300706956ec0923
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-20 08:21:26 +09:00
David Pursehouse 0c259eaf1d Replace explicit calls to initCause where possible
Where the exception being thrown has a constructor that takes a
Throwable, use that instead of instantiating the exception and then
explicitly calling initCause.

Change-Id: I06a0df407ba751a7af8c1c4a46f9e2714f13dbe3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-20 08:02:34 +09:00
David Pursehouse 19864c6c02 Merge changes I50095928,Idadec0ab,I1f2747d6,I6d2a7e28
* changes:
  LargeObjectException: Add constructor that takes Throwable
  InvalidPatternException: Add constructor that takes Throwable
  Don't unnecessarily explicitly call CorruptObjectException#initCause
  Use new StoredObjectRepresentationNotAvailableException constructor
2017-12-19 18:02:11 -05:00
David Pursehouse c228f201a6 LargeObjectException: Add constructor that takes Throwable
Change-Id: I500959286075f8ba4d0aa5820febd28c9c94ea1b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 23:27:53 +09:00
David Pursehouse 06bab95e00 InvalidPatternException: Add constructor that takes Throwable
Change-Id: Idadec0abc1c6d76f19f51a65a4b45df444c20486
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 23:27:53 +09:00
David Pursehouse 0f1c160aa7 Don't unnecessarily explicitly call CorruptObjectException#initCause
CorruptObjectException has a constructor that takes Throwable and
calls initCause with it.  Use that instead of instantiating the
exception and explicitly calling initCause.

Change-Id: I1f2747d6c4cc5249e93401b9787eb4ceb50cb995
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 23:27:53 +09:00
David Pursehouse 365c6cb387 Use new StoredObjectRepresentationNotAvailableException constructor
In 5e7eed4 a new StoredObjectRepresentationNotAvailableException
constructor was added, that takes a Throwable to initialize the
exception cause.

Update more call sites to use this constructor instead of first
instantiating it and explicitly calling initCause().

All callers now use the new constructor, so annotate the other one as
deprecated.

Change-Id: I6d2a7e289a95f0360ddebf904cfd8b6c18fef10c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 23:27:53 +09:00
Matthias Sohn 7b93ae0987 Fix javadoc in org.eclipse.jgit submodule package
Change-Id: Idc2a32a2e10d1cfc0b23a4f3fd1bf29840724336
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 14:03:21 +01:00
Matthias Sohn 56cc6afeba Fix javadoc in org.eclipse.jgit storage/file and pack package
Change-Id: If1fee165782823dc21d896073f60ee838365463d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 14:00:29 +01:00
Matthias Sohn 0cba440277 Fix javadoc in org.eclipse.jgit revwalk package
Change-Id: I3fabab8afa284b1919ab7bc656cab19e56ed474e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:57:14 +01:00
Matthias Sohn 23f3b6ab24 Fix javadoc in org.eclipse.jgit patch and revplot package
Change-Id: I6f1aba98bf7034cb51494c546806cf1b72dd1473
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:57:11 +01:00
Matthias Sohn 463dad2ed6 Fix javadoc in org.eclipse.jgit nls and notes package
Change-Id: I1b65fba5b4856f98974dc10f549540d401ef916f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:49:59 +01:00
Matthias Sohn a2f2f65390 Fix javadoc in org.eclipse.jgit merge package
Change-Id: I735d0f2e9f10531ed43b7b3dd6314c574392422f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:48:55 +01:00
Matthias Sohn 8a6af368c4 Fix javadoc in org.eclipse.jgit lib package
Change-Id: I1e85a951488177993521ce177fdea212615e6164
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:43:54 +01:00
Matthias Sohn d0342be42d Fix javadoc in org.eclipse.jgit storage/reftree package
Change-Id: Ie206b5340ad2019a1e0bd2bcede2c1e5a279f2d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:39:10 +01:00
Matthias Sohn 43e26de7ec Fix javadoc in org.eclipse.jgit storage/reftable package
Change-Id: I14764c5d5b2309d82fe2ccc0593120b51328bf41
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:39:10 +01:00
Matthias Sohn 783dbf1b03 Fix javadoc in org.eclipse.jgit storage/pack package
Change-Id: Id1b7d392e1bb36079edaf16450e73a044a318e7e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:39:09 +01:00
Matthias Sohn c6d17443ad Fix javadoc in org.eclipse.jgit storage/io package
Change-Id: I2db781311af79510b26fd05cc0556623e75e3eff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:39:09 +01:00
Matthias Sohn 5480da5999 Fix javadoc in org.eclipse.jgit storage/file package
Change-Id: Ieb2f66aef2cab7e2a6d8e35c5f5047da881994dd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:39:07 +01:00
Matthias Sohn a224b78675 Fix javadoc in org.eclipse.jgit dfs package
Change-Id: I1f5e3dc3ba34b323ee7244dbefee207ce19e6021
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-19 13:35:25 +01:00
David Pursehouse 305b488975 StoredObjectRepresentationNotAvailableException: Add TODO to fix API in 5.0
Change-Id: I9a0e6acac1b88ddf257fe7b2b7d0142be20250ea
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 10:48:06 +09:00
David Pursehouse 5e7eed41f6 StoredObjectRepresentationNotAvailableException: Add constructor that takes cause
If the cause can be passed into the constructor, callers don't need to
instantiate it and then explicitly call initCause.

Note that the constructors in this class cause "non-API parameter type"
warnings because ObjectToPack is internal, however it's probably OK
since the only non-internal reference to it is in the pgm.debug package.

Change-Id: Ia4eab24e79f9afe6214ea8160137d941d4048319
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-19 10:40:57 +09:00
David Pursehouse 1e141469f1 Merge changes Ifc34e96a,I72be0a0d
* changes:
  Fix javadoc in org.eclipse.jgit rewalk package
  Fix javadoc in org.eclipse.jgit ketch package
2017-12-18 18:33:40 -05:00
Dave Borowitz 31a2d09c9c Config: Rewrite subsection and value escaping and parsing
Previously, Config was using the same method for both escaping and
parsing subsection names and config values. The goal was presumably code
savings, but unfortunately, these two pieces of the git config format
are simply different.

In git v2.15.1, Documentation/config.txt says the following about
subsection names:

  "Subsection names are case sensitive and can contain any characters
  except newline (doublequote `"` and backslash can be included by
  escaping them as `\"` and `\\`, respectively).  Section headers cannot
  span multiple lines.  Variables may belong directly to a section or to
  a given subsection."

And, later in the same documentation section, about values:

  "A line that defines a value can be continued to the next line by
  ending it with a `\`; the backquote and the end-of-line are stripped.
  Leading whitespaces after 'name =', the remainder of the line after
  the first comment character '#' or ';', and trailing whitespaces of
  the line are discarded unless they are enclosed in double quotes.
  Internal whitespaces within the value are retained verbatim.

  Inside double quotes, double quote `"` and backslash `\` characters
  must be escaped: use `\"` for `"` and `\\` for `\`.

  The following escape sequences (beside `\"` and `\\`) are recognized:
  `\n` for newline character (NL), `\t` for horizontal tabulation (HT,
  TAB) and `\b` for backspace (BS).  Other char escape sequences
  (including octal escape sequences) are invalid."

The main important differences are that subsection names have a limited
set of supported escape sequences, and do not support newlines at all,
either escaped or unescaped. Arguably, it would be easy to support
escaped newlines, but C git simply does not:

  $ git config -f foo.config $'foo.bar\nbaz.quux' value
  error: invalid key (newline): foo.bar
  baz.quux

I468106ac was an attempt to fix one bug in escapeValue, around leading
whitespace, without having to rewrite the whole escaping/parsing code.
Unfortunately, because escapeValue was used for escaping subsection
names as well, this made it possible to write invalid config files, any
time Config#toText is called with a subsection name with trailing
whitespace, like {foo }.

Rather than pile hacks on top of hacks, fix it for real by largely
rewriting the escaping and parsing code.

In addition to fixing escape sequences, fix (and write tests for) a few
more issues in the old implementation:

* Now that we can properly parse it, always emit newlines as "\n" from
  escapeValue, rather than the weird (but still supported) syntax with a
  non-quoted trailing literal "\n\" before the newline. In addition to
  producing more readable output and matching the behavior of C git,
  this makes the escaping code much simpler.
* Disallow '\0' entirely within both subsection names and values, since
  due to Unix command line argument conventions it is impossible to pass
  such values to "git config".
* Properly preserve intra-value whitespace when parsing, rather than
  collapsing it all to a single space.

Change-Id: I304f626b9d0ad1592c4e4e449a11b136c0f8b3e3
2017-12-18 17:46:37 -05:00
Matthias Sohn 5bd3e75094 Fix javadoc in org.eclipse.jgit rewalk package
Change-Id: Ifc34e96a56df30e3b73bef812eea943623af7906
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 17:11:46 +01:00
Matthias Sohn e3a04b6c41 Fix javadoc in org.eclipse.jgit ketch package
Change-Id: I72be0a0d5ac7d3e957597803bd103dbbec141ba4
2017-12-18 17:10:20 +01:00
Matthias Sohn 6dca3cc024 Fix javadoc in org.eclipse.jgit internal and fsck packages
Change-Id: Ib12da10aacda9389d594bf4f521e9a58d1935701
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:25:04 +01:00
Matthias Sohn 107c71a6e6 Fix javadoc in org.eclipse.jgit ignore package
Change-Id: I1a81d371420cd4cf90ab9e048026c0ab8a763018
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:10 +01:00
Matthias Sohn d1804d3f74 Fix javadoc in org.eclipse.jgit hooks package
Change-Id: I3b644048eb0fc19f94ba8f9799b5a2310481103f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:09 +01:00
Matthias Sohn 5e2e111280 Fix javadoc in org.eclipse.jgit gitrepo package
Change-Id: I2604c7bca87f005004d6d6c80fa9a39a7a1e3807
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:09 +01:00
Matthias Sohn 6c83cc1660 Fix javadoc in org.eclipse.jgit fnmatch package
Change-Id: I14384c3bf3c41f8e1c62ec117837c2fc782a832f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:08 +01:00
Matthias Sohn dc91f4ef2c Fix javadoc in org.eclipse.jgit events package
Change-Id: Ifcb9c67daeb9da84a1461a4f731523ac5df3a223
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:08 +01:00
Matthias Sohn 6478577899 Fix javadoc in org.eclipse.jgit errors package
Change-Id: I46aa5c3073b99a311a1a97fc57d8f29d32524482
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:07 +01:00
Matthias Sohn c281692c06 Fix javadoc in org.eclipse.jgit dircache package
Change-Id: Ib485eb217ac6be70519816f8cc0396931043a3d1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 13:19:07 +01:00
David Pursehouse 1463bb9b87 EmtpyCommitException: Add TODO to fix misspelled class name in 5.0
Change-Id: I5bb145d6d6cbaaa2d8cfb2febad7a008ca921236
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-12-18 05:51:14 -05:00
Christian Halstrick aa60a131f5 Merge "PushConnectionTest: Increase maxCommandBytes yet again" 2017-12-18 05:50:03 -05:00
David Pursehouse 89c8be2045 Merge changes I7162d729,I2761ea91
* changes:
  Fix javadoc org.eclipse.jgit diff package
  Fix javadoc in org.eclipse.jgit annotations and api packages
2017-12-18 05:49:51 -05:00
Christian Halstrick 019735b2f8 Merge "Repeat: Fix javadoc to say 'annotation' instead of 'interface'" 2017-12-18 05:48:45 -05:00
Christian Halstrick 6f730d0bb6 Merge "Remove redundant @SuppressWarnings("unused")" 2017-12-18 05:48:09 -05:00
Christian Halstrick 12532ef3ae Merge "PathTreeFilterHandler: Remove unused import" 2017-12-18 05:46:12 -05:00
Matthias Sohn 4d8233f237 Fix javadoc org.eclipse.jgit diff package
Change-Id: I7162d72916abc8533ad37e8b17335ff4a70d6519
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 10:47:19 +01:00
Matthias Sohn 0210e0e299 Fix javadoc in org.eclipse.jgit annotations and api packages
Change-Id: I2761ea91f8dfed16ea54e7a6646af03a30c15ec9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-18 10:45:50 +01:00
Matthias Sohn 4e27a16081 Fix javadoc in org.eclipse.jgit blame package
Change-Id: I116dacc7f4ace341ec6ffae2ab96b53496d89f64
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-17 20:23:33 -05:00
Matthias Sohn df2bcbfb23 Fix javadoc in org.eclipse.jgit attributes package
Change-Id: I12968f4be805266f285a518a014b8bd1d0c23bae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-17 20:23:24 -05:00