Commit Graph

6811 Commits

Author SHA1 Message Date
Minh Thai 01f084f5d9 Strongly reference indices in DfsPackFile
DfsBlockCache.Ref might get cleared out if the JVM is running out of
memory. As a result, the index is not persisted for the request and
will be reloaded unnecessarily.

Change-Id: I3b57ad5e6673f77f2dc66177a649ac412a97fe20
Signed-off-by: Minh Thai <mthai@google.com>
2019-02-21 16:48:43 -08:00
Matthias Sohn e4fdca7355 Update Orbit to S20190219190953
- Orbit milestone for 2019-03 M3
- fixes Apache httpclient 4.5.6

Bug: 544139
Change-Id: Ib225d90dd26f6f3665d4feacecfbba4a28251a0b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-19 23:21:09 -05:00
David Pursehouse 368b519440 Update README
- Consistently refer to the project as "JGit", rather than "jgit".

- Convert the contribution guide link to markdown syntax.

Change-Id: I896b8112f3f1a77255883e0deb153e8937999a84
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-19 08:34:38 +09:00
Matthias Sohn 7611149339 Update README
Change-Id: Ibf77553f89871e34d7617d2a648fb0dc7904325d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-18 08:42:07 -05:00
David Pursehouse 2902255526 Merge branch 'stable-5.3'
* stable-5.3:
  ObjectDirectory: extra logging on packfile exceptions
  Prepare 5.3.0-SNAPSHOT builds
  JGit v5.3.0.201901162155-m1
  Fix tools/version.sh
  JGit v5.3.0.201901161700-m1

Change-Id: I3c511fbc08f21eec5bb49d443de33d43094da4a4
2019-02-18 11:22:31 +09:00
David Pursehouse 9d02e52406 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I4bbeb1d28ab042e3c6c74f7284f5d882ed034305
2019-02-18 11:21:38 +09:00
David Pursehouse 90876890bc Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: Id2fea30664d53b31ad026ee5ae06a5a24d731a52
2019-02-18 11:20:56 +09:00
Matthias Sohn 3ae22bdf66 Add missing @since tag for new API method getUpdateIndex
Change-Id: Idd4a580e241a9105a55bc6f0457ad02a35e55faf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-17 20:58:25 -05:00
Matthias Sohn ae79969715 Fix NPE in PlotCommitList
Bug: 544513
Change-Id: I2fca766bbdc441a2dca947fba5dde532de7a10fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-18 01:25:12 +01:00
David Pursehouse 0368906353 CommitBuilder: Deprecate setEncoding(String)
Deprecate the method in favor of setEncoding(Charset).

Update the only caller in the code base that was still using
the deprecated variant.

Change-Id: I6357f2d0c727007013c72e9d5b7c72a3f5f3f2b1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-18 00:14:35 +01:00
David Pursehouse e5c4057467 CommitBuilder: Add missing periods on methods' Javadoc
Change-Id: Ibcf64b23de8534f7831d6e40ee4b0ad2bade74ce
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-18 00:14:34 +01:00
Luca Milanesio 962babc4b2 ObjectDirectory: extra logging on packfile exceptions
Display extra logging, including the exception with the associated
stacktrace, whenever a packFile can't be read and thus removed
from the packlist.

Change-Id: I97a4e31dc427bfcc0baae438dcbe2dcd4704b824
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-02-14 10:44:00 +09:00
David Pursehouse a98906cc80 Upgrade wagon-ssh to 3.3.2
Change-Id: I203572eb47187d476622eb416f6ac8d791b747c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-14 10:42:37 +09:00
Minh Thai 2b7fa04dad Fix bug in copyPackBypassCache's skip 'PACK' header logic
Bug caused the pack to be 12 bytes short when cold cache.  Also added
test for copyPackAsIs method.

Change-Id: Idf8fb0e50d1215245d4b032e2e00df4b218c115f
Signed-off-by: Minh Thai <mthai@google.com>
2019-02-13 12:48:05 -08:00
David Pursehouse 59e7596160 Upgrade spotbugs to 3.1.11
Change-Id: I24bb63fc5e1241420f6fc72e8c4708d5201c4f2b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-04 20:15:13 +09:00
Thomas Wolf a29d11775c Atomic file creation: hard-linking may not be allowed
Android for instance forbids hard linking via a SELinux
policy. If we can't hard link, the NFS work-around for
atomic file creation cannot work at all. In this case,
fall back to not using the hard-linking mechanism.

Android throws an AccessDeniedException, so we catch that.
The javadoc on Files.createLink() indicates that another
possibility might be a SecurityException, so catch that,
too.

Bug: 543956
Change-Id: I551b7a45f7b2fbbd8cf94f0b7233dbd8a200520e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-02 23:23:46 +01:00
Matthias Sohn bad83e5ecd Update Orbit to S20190129210011
This is the Orbit stable build for 2019-03 M2

Change-Id: I6db8e030af6bcec9c50065cb66211280d366dfa8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-30 10:52:38 +01:00
Matthias Sohn 8cad84ccfb Fix GC.deleteEmptyRefsFolders
This method tried to iterate spurious files which may exist in the
.git/refs folder, e.g. on Mac a .DS_Store may have been created there by
inspecting the folder using the finder application. This led to a
NotDirectoryException when deleteEmptyRefsFolders tried to create an
iterator for such a file entry. Skip files contained in the refs folder
to ensure the method only tries to iterate contained folders but not
files.

Change-Id: I5f31e733072a35db1e93908a9c69a8891ae5c206
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-28 02:04:45 -05:00
Thomas Wolf e7b4d108e1 Enable cloning only specific tags
Single-branch-clone should be able to clone a single tag. Enhance
CloneCommand to accept also full refs of tags in setBranchesToClone().
Make sure we also include fetch ref specs for the fetch command for
tags. This mimics the behavior of native git's single-branch clone:
git clone --branch <tag> --single-branch <URI>

Bug: 542611
Change-Id: I285cf043751d9b0ba71258ee8214c0e5d1191428
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-01-27 22:56:06 +01:00
Matthias Sohn 0d33af9ff5 Delete jgit-4.5 target platform
Change-Id: If38b605b98cad55ee83cb7c0a6a972489031e447
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-27 21:04:59 +01:00
Matthias Sohn 7f4c03c15b Add 4.11-staging target platform and update Orbit to I20190123233226
Update
- org.apache.httpcomponents.httpcore to 4.4.10.v20190123-2214
- org.apache.httpcomponents.httpclient.source to 4.5.6.v20190123-2215
- org.bouncycastle.bcpg to 1.60.0.v20181210-2057
- org.bouncycastle.pkix to 1.60.0.v20181210-2057
- org.bouncycastle.prov to 1.60.0.v20181210-2057

Change-Id: I132b6686aa29b2a76cc529f7cae34115604c754d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-27 21:04:59 +01:00
David Pursehouse 05a37ec49a Upgrade jacoco-maven-plugin to 0.8.3
Change-Id: I1df9ed2d696613297f9e694876d94c28aaf56339
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-27 16:57:15 +09:00
David Pursehouse afb6339314 Bazel: Format BUILD file with buildifier
$ buildifier -lint=fix BUILD

Change-Id: Ie2e069db3936ce6a85c4c29e6a0137cda5e21f09
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-24 11:43:37 +09:00
Thomas Wolf 447e107069 RenameBranchCommand: more consistent handling of short ref names
Several problems:

* The command didn't specify whether it expected short or full names.
* For the new name, it expected a short name, but then got confused
  if tags or both local and remote branches with the same name existed.
* For the old name, it accepted either a short or a full name, but
  again got confused if a short name was given and a tag with the
  same name existed.

With such an interface, one cannot use Repository.findRef() to
reliably find the branch to rename. Use exactRef() for the new
name as by the time the Ref is needed its full name is known.
For determining the old Ref from the name, do the resolution
explicitly: first try exactRef (assuming the old name is a full
name); if that doesn't find anything, try "refs/heads/<old>" and
"refs/remotes/<old>" explicitly. Throw an exception if the name
is ambiguous, or if exactRef returned something that is not a
branch (refs/tags/... or also refs/notes/...).

Document in the javadoc what kind of names are valid, and add tests.

A user can still shoot himself in the foot if he chooses exceptionally
stupid branch names. For instance, it is still possible to rename a
branch to "refs/heads/foo" (full name "refs/heads/refs/heads/foo"),
but it cannot be renamed further using the new short name if a branch
with the full name "refs/heads/foo" exists. Similar edge cases exist
for other dumb branch names, like a branch with the short name
"refs/tags/foo". Renaming using the full name is always possible.

Bug: 542446
Change-Id: I34ac91c80c0a00c79a384d16ce1e727c550d54e9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-01-23 19:10:36 +01:00
Thomas Wolf 2cb842ef02 SshdSessionFactory: generalize providing default keys
Provide a mechanism for a subclass to provide its own set
of default identities from anywhere as an Iterable<KeyPair>.

The default implementation is functionally unchanged and uses
the known default identity files in the ~/.ssh directory. A subclass
can override the getDefaultKeys() function and return whatever keys
are appropriate.

Bug: 543152
Change-Id: I500d63146bc67e20e051f617790eb87c7cb500b6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-01-22 06:42:26 -05:00
Gunnar Wagenknecht c4420d2434 Allow to check for signing key
The new API is intended for UIs to check if signing will be possible or
would fail

Bug: 543579
Change-Id: I6ce1fd4210e46d49dcdf420c99d08c93e022136c
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
2019-01-22 03:38:36 -05:00
Thomas Wolf 55966dc592 Handle premature EOF in BundleFetchConnection
BundleFetchConnection.readLine() must abort on EOF, otherwise
it gets stuck in an endless loop.

Bug: 543390
Change-Id: I4cb3428560277888af114b928950d620bb6564f9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-01-22 01:49:03 -05:00
Matthias Sohn 39b8f43dcd pgm: Fix missing braces in Version.run()
Change-Id: I4c5633846320f0324714f635b2be388b17cf79fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:55:08 +01:00
Matthias Sohn 7383d34737 pgm: Handle IOException in Version command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I37e6e3aaba411858042afac02098ce9eaa06f258
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:54:28 +01:00
Matthias Sohn e74592605e pgm: Fix missing braces in UploadPack.run()
Change-Id: I923af9b4ce62d5098828f4322a2a508bf3927bbd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:52:57 +01:00
Matthias Sohn 9bf8a1bf14 pgm: Handle IOException in UploadPack command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ife1d8e88387a32de63b0ef31f45499babdbdde3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:52:27 +01:00
Matthias Sohn 7d073c129c pgm: Handle exceptions in Tag command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I16b528fad74d0c5346d054b3c29070331d60db7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:48:47 +01:00
Matthias Sohn 88d60bf51a pgm: Fix missing braces in Status.run()
Change-Id: Ie30df8ed3d9a1e676f130214a173b622eaf67c6f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:47:13 +01:00
Matthias Sohn c6bd13922f pgm: Handle exceptions in Status command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I662a343fbb46c35090bd6f840e5a35a88036a65a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:46:37 +01:00
Matthias Sohn b33124c0ee pgm: Fix missing braces in ShowRef.run()
Change-Id: I92bc2008c72bd4495dc3df47a9dd7eb242aab30f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:44:55 +01:00
Matthias Sohn 5ca4075c45 pgm: Handle IOException in ShowRef command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: If18a5d8013f1cb393af3a5e5a1ec9613ac2151bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:44:20 +01:00
Matthias Sohn 390fe5b878 pgm: Fix missing braces in Show.run()
Change-Id: I50097649f1355856e342035d54c55e65270ef507
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:42:41 +01:00
Matthias Sohn e5511f2fbb pgm: Handle exceptions in Show command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I1c6cc5ecdc44b81e5f3f9b7dc64c3653de5475ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:41:37 +01:00
Matthias Sohn 9ef393c747 pgm: Fix missing braces in Rm command
Change-Id: I5ad2f02516917bbd02aa0eb4fb6b05d4b06dc670
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:39:32 +01:00
Matthias Sohn ed0d6e69f9 pgm: Handle GitAPIException in Rm command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I55c15a35369e790a3ca946d6db0097a57ac6fae5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:39:04 +01:00
Matthias Sohn 795c265c11 pgm: Handle exceptions in RevParse command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Iae510d8c6af9acd587822a28ad48eab0b2a96ccd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:36:32 +01:00
Matthias Sohn 23af4452e8 pgm: Externalize error message
Change-Id: Id9e33104c9681dc9a57674c1648c994a503fa6b8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:30:51 +01:00
Matthias Sohn 7cee790173 pgm: Fix missing braces in Reset.run()
Change-Id: I1e854ab81063601eb4ff159aabc559cb65ce6ece
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:26:27 +01:00
Matthias Sohn 5c05b9f38c pgm: Handle GitAPIException in Reset command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I70dce366081cd1fc4539cf195d6310fef1080eb3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:23:36 +01:00
Matthias Sohn c03700dcb0 pgm: Handle GitAPIException in Repo command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.


Change-Id: I1a636478bfae8cc0635a3e57be252126e69c19cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:21:26 +01:00
Matthias Sohn ec7ec69819 pgm: Handle exceptions in Remote command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ie1985c2570213217c2ea0f376ff99d19bfed4e0c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:19:55 +01:00
Matthias Sohn d8fec824e4 pgm: Handle exceptions in Reflog command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Id25eb523c12c07cbd14e31edfb8b5d7ec9b3ccf3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:19:54 +01:00
Matthias Sohn 8615c042ff pgm: Handle IOException in ReceivePack command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I9cecd236a8df8a2c2972d5da6031a121f25b1daa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 23:14:24 +01:00
David Pursehouse 3b94cd008f SmartClientSmartServerTest: Open Repository in try-with-resource
Since 52923e9 ("LocalDiskRepositoryTestCase#createRepository: Default
auto-close to false", Jan 20, 2019) the createBareRepository method
creates repositories that do not get automatically closed in #tearDown.

Convert invocations of createBareRepository to use try-with-resource.

Change-Id: I320030c5d4438713971bee33316bff408bac47fc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 15:54:30 +09:00
David Pursehouse ec72e8029e SmartClientSmartServerTest: Open ObjectInserter.Formatter in try-with-resource
Change-Id: I7005f5821394a3e237cf877cf38557b6a62cacb3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 15:20:25 +09:00