Commit Graph

5034 Commits

Author SHA1 Message Date
Matthias Sohn 5f79ef0ba4 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Silence boxing warning
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: I8f6bc09540727c6273d22775a9f9ca382a729c9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-22 23:07:01 +01:00
Matthias Sohn 182d3b3dad Silence boxing warning
Change-Id: I36c40eb91ce0c51f89b47911fa14beffcbc0a7cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-22 21:34:37 +01:00
Matthias Sohn 3ac44f1b38 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: Ie9c8e0d9172c8d53f075c284bf2a9677980d8dfb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-22 21:34:08 +01:00
Matthias Sohn 7608de5e5d Prepare 4.5.5-SNAPSHOT builds
Change-Id: I71f946f2875716670a2d74c21a8ab38a1f53a25c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-22 19:27:22 +01:00
Matthias Sohn 6372c60ab2 JGit v4.5.4.201711221230-r
Change-Id: Ia1079da239c5b3fde1ba8d2acc4e465a46297b4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-22 18:31:24 +01:00
Christian Halstrick 10e65cb4fa Fix LockFile semantics when running on NFS
When running on NFS there was a chance that JGits LockFile
semantic is broken because File#createNewFile() may allow
multiple clients to create the same file in parallel. This
change provides a fix which is only used when the new config
option core.supportsAtomicCreateNewFile is set to false. The
default for this option is true. This option can only be set in the
global or the system config file. The repository config file is not
taken into account in this case.

If the config option core.supportsAtomicCreateNewFile is true
then File#createNewFile() is trusted and the behaviour doesn't
change.

But if core.supportsAtomicCreateNewFile is set to false then after
successful creation of the lock file a hardlink to that lock file is
created and the attribute nlink of the lock file is checked to be 2. If
multiple clients manage to create the same lock file nlink would be
greater than 2 showing the error.

This expensive workaround is described in
 https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
section III.d) "Exclusive File Creation"

Change-Id: I3d2cc48d8eb280d5f7039eb94da37804f903be6a
2017-11-22 18:15:11 +01:00
Christian Halstrick 218cf3403d Honor trustFolderStats also when reading packed-refs
Then list of packed refs was cached in RefDirectory based on mtime of
the packed-refs file. This may fail on NFS when attributes are cached.
A cached mtime of the packed-refs file could cause JGit to trust the
cached content of this file and to overlook that the file is modified.

Honor the config option trustFolderStats and always read the packed-refs
content if the option is false. By default this option is set to true
and this fix is not active.

Change-Id: I2b65cfaa8f4aba2efbf8a5e865d3f09f927e2eec
2017-11-21 21:21:22 +01:00
Matthias Sohn 960d7ff3e5 Prepare 4.5.4-SNAPSHOT builds
Change-Id: Id8b902bf2bf590b41f2e246c5ecf1592e1c411f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-26 08:08:46 +02:00
Matthias Sohn e21e2436d3 JGit v4.5.3.201708160445-r
Change-Id: I2d57144976e3683e180d3a42edc6c3bf2905e87c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-16 10:42:27 +02:00
Matthias Sohn 53becf1f59 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Update Oxygen Orbit p2 repository to R20170516192513
  Fix exception handling for opening bitmap index files

Change-Id: I669fe48ce0034f9ea1977d38ee39099497422c1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-14 23:50:52 +02:00
Matthias Sohn 985e3c6414 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Fix exception handling for opening bitmap index files

Change-Id: Ifb511238e3e98b1bc9f79a990807b940a17ebaa6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-14 23:43:05 +02:00
Matthias Sohn d9fd35281b Update Oxygen Orbit p2 repository to R20170516192513
Change-Id: I7f1b733ca414d77c9df5572df02e742e0a84ba2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-14 23:37:21 +02:00
Christian Halstrick 1ed1e40387 Fix exception handling for opening bitmap index files
When creating a new PackFile instance it is specified whether this pack
has an associated bitmap index file or not. This information is cached
and the public method getBitmapIndex() will always assume a bitmap index
file must exist if the cached data tells so. But it may happen that the
packfiles are repacked during a gc in a different process causing the
packfile, bitmap-index and index file to be deleted. Since JGit still
has an open FileHandle on the packfile this file is not really deleted
and can still be accessed. But index and bitmap index file are deleted.
Fix getBitmapIndex() to invalidate the cached packfile instance if such
a situation occurs.

This problem showed up when a gerrit server was serving repositories
which where garbage collected with native git regularly. Fetch and
clone commands for certain repositories failed permanently after a
native git gc had deleted old bitmap index files.

Change-Id: I8e620bec74dd3f310ba42024f9a657062f868f0e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-14 21:09:48 +02:00
Matthias Sohn 8afd9b1648 Prepare 4.7.2-SNAPSHOT builds
Change-Id: I7c127bd402cd84c68d8f33a32c6aad093a2264c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-06-08 13:33:44 +02:00
Matthias Sohn 1d14296975 JGit v4.7.1.201706071930-r
Change-Id: I28cd8fbe995d76c8a00e7db6ddf826e983d89043
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-06-08 01:19:38 +02:00
Yasuhiro Takagi a66e60a986 ArchiveCommand: Create prefix entry with commit time
The cgit archive command creates a prefix (root) directory entry
in the archive file. That entry's time is set to the commit time.

This patch makes jgit's behavior consistent with with cgit:

prefix: hoge/     -> creates prefix directory "hoge/" entry.
prefix: hoge////  -> creates prefix directory "hoge/" entry.
prefix: hoge/foo  -> does not create prefix directory entry, but for
                     each file/directory entry, prefix is added.

Change-Id: I2610e40ce37972c5f7456fdca6337e7fb07176e5
Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
2017-06-05 19:35:46 -04:00
David Turner 6b1e3c58b1 Run auto GC in the background
When running an automatic GC on a FileRepository, when the caller
passes a NullProgressMonitor, run the GC in a background thread. Use a
thread pool of size 1 to limit the number of background threads spawned
for background gc in the same application. In the next minor release we
can make the thread pool configurable.

In some cases, the auto GC limit is lower than the true number of
unreachable loose objects, so auto GC will run after every (e.g) fetch
operation.  This leads to the appearance of poor fetch performance.
Since these GCs will never make progress (until either the objects
become referenced, or the two week timeout expires), blocking on them
simply reduces throughput.

In the event that an auto GC would make progress, it's still OK if it
runs in the background. The progress will still happen.

This matches the behavior of regular git.

Git (and now jgit) uses the lock file for gc.log to prevent simultaneous
runs of background gc. Further, it writes errors to gc.log, and won't
run background gc if that file is present and recent. If gc.log is too
old (according to the config gc.logexpiry), it will be ignored.

Change-Id: I3870cadb4a0a6763feff252e6eaef99f4aa8d0df
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-06-06 01:18:29 +02:00
Han-Wen Nienhuys f17ec3928c Cleanup and test trailing slash handling in ManifestParser
This is a workaround for
https://bugs.openjdk.java.net/browse/JDK-4666701.

Change-Id: Idd04657e8d95a841d72230f8881b6b899daadbc2
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-11 00:37:38 +02:00
Han-Wen Nienhuys 84d855cda7 ManifestParser: Throw exception if remote does not have fetch attribute
In the repo manifest documentation [1] the fetch attribute is marked
as "#REQUIRED".

If the fetch attribute is not specified, this would previously result in
NullPointerException. Throw a SAXException instead.

[1] https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt

Change-Id: Ib8ed8cee6074fe6bf8f9ac6fc7a1664a547d2d49
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-10 15:08:32 +02:00
David Pursehouse 52be84aea5 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.5.3-SNAPSHOT builds
  JGit v4.5.2.201704071617-r

Change-Id: I5d2044c59af7bc2786fb66ebf5130e412884d74b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-09 20:03:33 +09:00
David Pursehouse c047e2ad2d Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.3-SNAPSHOT builds
  JGit v4.5.2.201704071617-r

Change-Id: I4e1915d3a88e15c9ef1fb2b470b7f3b821243ff5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-09 17:22:39 +09:00
Matthias Sohn 3db0f507ee Prepare 4.5.3-SNAPSHOT builds
Change-Id: I69681b7a5687ca76bd0dd5d3e7ce2cff841d0e32
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-08 00:31:09 +02:00
Matthias Sohn c1d3ecbeab JGit v4.5.2.201704071617-r
Change-Id: I66402643d7c84c90bf5cefed4d2ec3aa68c94cfb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-07 22:17:27 +02:00
David Pursehouse 661232b1e9 PushConnectionTest: Increase maxCommandBytes again
It was already increased in 61a943e, but that was still not enough to
take into account the length of snapshot versions.

Change-Id: Ib54cec97e97042fe274b87a3a1afa9bb06c8bf19
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-06 11:45:02 +09:00
Matthias Sohn 6a311a071f Prepare 4.7.1-SNAPSHOT
Change-Id: I16a45035258276217446bccc0ad1b0991383aa0c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-06 00:16:53 +02:00
Matthias Sohn 9f4c10784b JGit v4.7.0.201704051617-r
Change-Id: Ic2bd6aca0b7a7e0597ffc1f7cf647b49878f9950
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-05 22:17:44 +02:00
Yasuhiro Takagi b26102469c TarFormat: Use commit time as timestamp for entries
This was already done for ZipFormat in 1448ec3.

Change-Id: Ie131938a3f640c68718dc793d18dd35be5c71e7c
Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-05 10:01:45 +09:00
David Pursehouse 61a943e03d PushConnectionTest#limitCommandBytes: Increase maxCommandBytes
A higher limit is required to account for proper JGit version number
being sent in the UserAgent.

The version string "4.7.0.201704031717-r" is 20 characters, however
the strings used during development are shorter:

- When running from mvn, "4.7.0.qualifier" is used; 15 characters
- When running in Eclipse, "unknown" is used; 7 characters

Change-Id: I9aca2f71389a42fedce305e9078db016869c3d1a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-04 21:37:48 +09:00
David Pursehouse 61e336475d Downgrade Jetty to 9.3.17.v20170317 in Bazel build
Jetty was downgraded on stable-4.6 which doesn't have a Bazel
build.

Change-Id: Ibeb91436169e852a4241189f80e4895b54ce3cd0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-03 08:33:33 +09:00
Matthias Sohn 6d5d3e4584 Merge branch 'stable-4.6'
* stable-4.6:
  Update Jetty to 9.3.17.v20170317
  Revert "Update Jetty to 9.4.1.v20170120 in buck build"
  Revert "Update Jetty to 9.4.1.v20170120"

Change-Id: I9193b568cce9c72da899a8f3eaaf833956438e13
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-02 15:45:00 +02:00
Matthias Sohn 1b45b06116 Update Jetty to 9.3.17.v20170317
Update to the latest 9.3 version until we have a solution for bug 514336
we face with 9.4.x versions.

Change-Id: I6d8d476abe8677ce865a08099bb77330effc700a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-02 11:53:29 +02:00
Matthias Sohn ebc290a4a0 Revert "Update Jetty to 9.4.1.v20170120 in buck build"
This reverts commit d3b80b951c.

Change-Id: I596ba596f3e857346020e01b0a018d90a0b27edd
2017-04-01 13:03:48 +02:00
David Pursehouse da6fa14fd1 Revert "Update Jetty to 9.4.1.v20170120"
This reverts commit e05caf91f1.

Change-Id: Ia4287f130034a790759b5035505a093b4616a05a
2017-03-31 14:50:20 +09:00
Matthias Sohn b65a764b6b Remove unused import from ManifestParser
Change-Id: Ie60ef9c7bc6ce0fdf017949ebfb9a21753e70506
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-31 00:38:36 +02:00
Matthias Sohn 94accd719a Downgrade jetty to 9.3.9.v20160517
This works around the problems we faced with jetty 9.4.3.v20170317.

Bug: 514336
Change-Id: I7e9dd539414624d71587c55cb436b843949aa296
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-31 00:36:58 +02:00
Matthias Sohn 7395c7af59 Require jetty 9.4.0 consistently
Change-Id: If9de4c0e43850dec46858bd58e9692a7e099cbc3
2017-03-30 13:56:16 +02:00
Han-Wen Nienhuys f32d65759c Document the intended use of RepoCommand#setURI()
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I4a59dd8278b7b0026094692127b7f55e89c10bae
2017-03-29 16:54:29 +02:00
Han-Wen Nienhuys 6e652846f6 Noop changes to ManifestParser
* Parse the base URL in ManifestParser construction.  This will signal
  errors earlier.

* Simplify stripping of trailing slashes.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I4a86f68c9d7737f71cf20352cfe26288fbd2b463
2017-03-29 13:51:37 +02:00
Han-Wen Nienhuys 27b05c7d71 Consistently use 'path' for the path to a subrepo in RepoCommand
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I79ea7eb7b4d319e0100e3121aca5ef82eb8ad92a
2017-03-27 17:36:56 -04:00
Matthias Sohn 251abbfcd1 Merge branch 'stable-4.6'
* stable-4.6:
  Only mark packfile invalid if exception signals permanent problem
  Don't flag a packfile invalid if opening existing file failed
  Prepare 4.5.2-SNAPSHOT builds

Change-Id: Ife4efad1135d3870a5a0fb71e60b9524fb8777ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-27 22:45:59 +02:00
David Pursehouse 7f013924a8 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Only mark packfile invalid if exception signals permanent problem
  Don't flag a packfile invalid if opening existing file failed
  Prepare 4.5.2-SNAPSHOT builds

Change-Id: I20b50981adc54c426666015ff04fe3bb1db9abd9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-03-27 10:14:50 +09:00
Matthias Sohn aaf3c5154e Only mark packfile invalid if exception signals permanent problem
Add NoPackSignatureException and UnsupportedPackVersionException to
explicitly mark permanent unrecoverable problems with a pack 

Assume problem with a pack is permanent only if we are sure the
exception signals a non-transient problem we can't recover from:
- AccessDeniedException: we lack permissions
- CorruptObjectException: we detected corruption
- EOFException: file ended unexpectedly
- NoPackSignatureException: pack has no pack signature
- NoSuchFileException: file has gone missing
- PackMismatchException: pack no longer matches its index
- UnpackException: unpacking failed
- UnsupportedPackIndexVersionException: unsupported pack index version
- UnsupportedPackVersionException: unsupported pack version

Do not attempt to handle Errors since they are thrown for serious
problems applications should not try to recover from.

Change-Id: I2c416ce2b0e23255c4fb03a3f9a0ee237f7a484a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-26 11:40:47 +02:00
Matthias Sohn 3104629e31 Raise minimum version of o.e.jetty.security to 9.4.0
This is required since we now use AbstractLoginService which was
introduced in Jetty 9.4.0.

Change-Id: Iee6e4ae456123099f7a99cc53c5ae02fd43bfa46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-25 23:34:24 +01:00
Luca Milanesio 363a3657b1 Don't flag a packfile invalid if opening existing file failed
A packfile random file open operation may fail with a
FileNotFoundException even if the file exists, possibly
for the temporary lack of resources.

Instead of managing the FileNotFoundException as any generic
IOException it is best to rethrow the exception but prevent
the packfile for being flagged as invalid until it is actually
opened and read successfully or unsuccessfully.

Bug: 514170
Change-Id: Ie37edba2df77052bceafc0b314fd1d487544bf35
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-25 01:33:18 +01:00
Matthias Sohn 11a12ceb0b Prepare 4.5.2-SNAPSHOT builds
Change-Id: I8485de1f3f63dc9ec445b8fb08093ca144aedc59
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-25 01:21:58 +01:00
David Pursehouse 471951928a Upgrade error_prone_core to 2.0.19
Change-Id: I019f6e8ce4b074697c2dfc6020b10dc003d0804d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-03-24 15:36:20 +09:00
David Pursehouse 5f902f07cc PullCommand: Add support for recursing into submodules
Add a new API method to set the recurse mode, and pass the mode into
the fetch command.

Extend the existing FetchCommandRecurseSubmodulesTest to also perform
the same tests for fetch. Rename the test class accordingly.

Change-Id: I12553af47774b4778f7011e1018bd575a7909bd0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-03-24 00:02:45 +01:00
David Ostrovsky fa2851ce78 bazel: Consume hamcrest through transitive dependency
In I3ab958ce8 explicit dependency in lib/BUILD were defined and most
of the bazel build implementation was switched to using it. Switch
test.bzl test implementation to using explicit dependencies as well.

Change-Id: I4413d1a45addeeb2a980d07669fa034c2eebb3a4
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2017-03-23 06:47:49 +01:00
Matthias Sohn 61f830d3a2 Explain in error message how to recover from lock failure
Bug: 483897
Change-Id: I70f8d9c82c1efe2928f072a2fb69461160f7c5f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-22 18:17:01 -04:00
Matthias Sohn 3df4e37276 Update orbit to S20170306214312 (Oxygen M6)
Change-Id: I44d2483c045c126e01751fed9365d4889a30ab2e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-22 22:20:49 +01:00