Commit Graph

4656 Commits

Author SHA1 Message Date
Matthias Sohn 0291b2eaf8 Prepare 4.5.8-SNAPSHOT builds
Change-Id: I70628cb8fcad0a60598dc937abbed63606a78599
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-16 00:34:19 +02:00
Matthias Sohn adccfd4503 JGit v4.5.7.201904151645-r
Change-Id: I3e32cf13f5cb99d8e570412d80d941740399c07d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-15 22:46:38 +02:00
Luca Milanesio d6e00d2015 Remember the cause for invalidating a packfile
Keep track of the original cause for a packfile invalidation.
It is needed for the sysadmin to understand if there is a real
underlying filesystem problem and repository corruption or if it is
simply a consequence of a concurrency of Git operations (e.g. repack
or GC).

Change-Id: I06ddda9ec847844ec31616ab6d17f153a5a34e33
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-11 10:55:45 +02:00
Matthias Sohn aa6e7e2c12 Fix API problem filters
Change-Id: I96e0ddc34251348ec4877c9d94b045eb1c53e758
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-11 00:34:20 +02:00
Luca Milanesio 82b1af31e2 Fix pack files scan when filesnapshot isn't modified
Do not reload packfiles when their associated filesnapshot is not
modified on disk compared to the one currently stored in memory.

Fix the regression introduced by fef78212 which, in conjunction with
core.trustfolderstats = false, caused any lookup of objects inside
the packlist to loop forever when the object was not found in the pack
list.

Bug: 546190
Change-Id: I38d752ebe47cefc3299740aeba319a2641f19391
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-09 14:31:39 +01:00
Matthias Sohn 08a5d2771d Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I5c0e7d59f137c27e4588f20f4472d3ea450cd59c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 16:07:23 +01:00
Matthias Sohn b29bb5cbb0 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix GC to delete empty fanout directories after repacking

Change-Id: Idce894a24e126e0fbe7bc9b6a3c64318f1a8eb75
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:55:47 +01:00
Matthias Sohn 1a289e3420 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I7118b9c668dcbb0f5435cc613e964c557bfebf01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:35:26 +01:00
Matthias Sohn f06de6b575 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix GC to delete empty fanout directories after repacking

Change-Id: Ibdbfe08eb290286fa738010bad1c604e857885cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:07:05 +01:00
Matthias Sohn 534ede2d81 Fix GC to delete empty fanout directories after repacking
The prune method did not delete empty fanout directories when loose
objects moved to a new pack file but only when loose unreferenced
objects were pruned.

Change-Id: Ia068f4914c54d9cf9f40b75e8ea50759402b5000
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-20 14:10:30 +01:00
Matthias Sohn 639d53721c Prepare 5.1.7-SNAPSHOT builds
Change-Id: Ica716b2ad18f8390e75466430ef81c86ea06f004
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:49:33 +01:00
Matthias Sohn a31756fbfc JGit v5.1.6.201903130242-r
Change-Id: Iaf5e451f72dc8512afee99a9f3fb91aa348e3cf5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:41:27 +01:00
Matthias Sohn b0d27cdae9 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I71771dcc086a9a0097bad74d65ec71ad97106a38
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:38:38 +01:00
Matthias Sohn 7480737aac Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I04c70f66c6f1e53bdc199fb5b24c9136c9a8e4f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:21:54 +01:00
Matthias Sohn 6a30ffd033 Prepare 4.11.8-SNAPSHOT builds
Change-Id: I92789b0c02e83786961b81556bf2faec5d26b0c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:13:36 +01:00
Matthias Sohn a888f80856 JGit v4.11.7.201903122105-r
Change-Id: I4fc62c304b5a8452ca72a3b305e5732a26120000
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:04:31 +01:00
Matthias Sohn 7204e35f93 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ic66dc00455c05f7627919f682a7221ffeef1629d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:55:24 +01:00
Matthias Sohn f53c2d11af Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ifcd8ea6a2b59f6f8e9d896d8407cfcaef0a9375d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:48:06 +01:00
Matthias Sohn 2b64345f53 Prepare 4.9.10-SNAPSHOT builds
Change-Id: I2bdbe822ee623c5f15a26d092136d8602cef06ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:34:49 +01:00
Matthias Sohn c28c3ab9f0 JGit v4.9.9.201903122025-r
Change-Id: I807d24461b3557eee48294bfaa652b2a13d78113
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:27:02 +01:00
Matthias Sohn c452c007ce Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I9a47153831f8eb10d3cd91b4157cf45385e5b13a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:18:01 +01:00
Matthias Sohn 2bf3cc56db Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I1136eaa1590b225ceaf16ba7552af0374253a74e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:16:28 +01:00
Matthias Sohn 317d747c5c Prepare 4.7.9-SNAPSHOT builds
Change-Id: I1602a6b811fd9f95e284153b560d8d9f855fae9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 23:26:43 +01:00
Matthias Sohn a2951a996f JGit v4.7.8.201903121755-r
Change-Id: Ia6dbde615671ed09789326aacad1655e7a7a59ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:55:42 +01:00
Matthias Sohn 92525b584a Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I3d1544d034783fe0fa1385dfe9b03ad8e9247c63
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:39:53 +01:00
Matthias Sohn d96eb8b3e6 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I029e1797447e6729de68bd89d4d69b324dbb3f5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:26:58 +01:00
Matthias Sohn a47367e5fb Prepare 4.5.7-SNAPSHOT builds
Change-Id: I5c275c542e12746c3d8ecf8462791969f9e89e12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 20:54:12 +01:00
Matthias Sohn 1cb31111f7 JGit v4.5.6.201903121547-r
Change-Id: I5a071ed10e1ac1ab28f992d45cde335c12556a80
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 20:47:04 +01:00
Luca Milanesio bf3d1ded35 Check for packfile validity and fd before reading
When reading from a packfile, make sure that is valid
and has a non-null file-descriptor.

Because of concurrency between a thread invalidating a packfile
and another trying to read it, the read() may result into a NPE
that won't be able to be automatically recovered.

Throwing a PackInvalidException would instead cause the packlist
to be refreshed and the read to eventually succeed.

Bug: 544199
Change-Id: I27788b3db759d93ec3212de35c0094ecaafc2434
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 15:06:05 +01:00
Luca Milanesio afef866a44 Move throw of PackInvalidException outside the catch
When a packfile is invalid, throw an exception explicitly
outside any catch scope, so that is not accidentally caught
by the generic catch-all cause, which would set the packfile
as valid again.

Flagging an invalid packfile as valid again would have
dangerous consequences such as the corruption of the in-memory
packlist.

Bug: 544199
Change-Id: If7a3188a68d7985776b509d636d5ddf432bec798
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 15:06:05 +01:00
Luca Milanesio 2d116cd0ab Use FileSnapshot to get lastModified on PackFile
Do not redundantly call File.lastModified() for extracting the
timestamp of the PackFile but rather use consistently the FileSnapshot
which reads all file attributes in a single bulk call.

Change-Id: I932675ae4fe56dcd3833dac249816f097303bb09
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 15:06:04 +01:00
Luca Milanesio 2dc572df24 Include size when comparing FileSnapshot
Due to finite filesystem timestamp resolution the last modified
timestamp of files cannot detect file changes which happened in the
immediate past (less than one filesystem timer tick ago).

Read and consider file size also, so that differing file size can help
to more accurately detect file changes without reading the file content.
Use bulk read to avoid multiple stat calls to retrieve file attributes.

Change-Id: I974288fff78ac78c52245d9218b5639603f67a46
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 14:39:14 +01:00
Luca Milanesio fef782128d Do not reuse packfiles when changed on filesystem
The pack reload mechanism from the filesystem works only by name
and does not check the actual last modified date of the packfile.

This lead to concurrency issues where multiple threads were loading
and removing from each other list of packfiles when one of those
was failing the checksum.

Rely on FileSnapshot rather than directly checking lastModified
timestamp so that more checks can be performed.

Bug: 544199
Change-Id: I173328f29d9914007fd5eae3b4c07296ab292390
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 14:30:36 +01:00
Matthias Sohn d4078dccda Silence API warnings for new API introduced for fixes
Change-Id: I3ea7ff2efd33ca6c780afaef9010cec82780d7fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 14:30:20 +01:00
Matthias Sohn 57f3ee4c16 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Reduce contention on PackFile.idx() function.

Change-Id: Ic50f375faa757076e2dfd6c25e9e0025482aa3d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:10:59 +01:00
Matthias Sohn 35e96348d3 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Reduce contention on PackFile.idx() function.

Change-Id: Ib1be8c04c9587c595f7d95df26f7be9b237bda40
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:09:45 +01:00
Matthias Sohn 495ecda567 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Reduce contention on PackFile.idx() function.

Change-Id: I5dd7576018ab2e85d77d336f97c8e77ad71520c9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:08:34 +01:00
Matthias Sohn 47d7f7aabb Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Reduce contention on PackFile.idx() function.

Change-Id: I277e53aa752c8ffb8560de710d27ecb58871ec02
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:06:17 +01:00
Juergen Denner 19c4380689 Reduce contention on PackFile.idx() function.
In case of concurrent pack file access, threads may wait on the idx()
function even for already open files. This happens especially with a
slow file system.

Performance numbers are listed in the bug report.

Bug: 543739
Change-Id: Iff328d347fa65ae07ecce3267d44184161248978
Signed-off-by: Juergen Denner <j.denner@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-11 19:52:26 +01:00
David Pursehouse 01cf73c7ab Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: If75b149e693005dd3fe06b523e6e6784bedf44c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:15:36 +09:00
David Pursehouse 3fc9d43339 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I9052e318b5d920770f7c7121d36e3c58df9d5f5a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:14:40 +09:00
David Pursehouse ae5ea80363 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I0847251eb010616a705e0b91df4bdebc225fa95d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:13:48 +09:00
Matthias Sohn 7b3ee6f62e Fix error log message in ObjectDirectory.handlePackError()
Change-Id: I154f392ad025c4b642eb1123d375a0afaa853885
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 997d785418)
2019-03-06 02:36:38 +01:00
Matthias Sohn e8f7bb3608 Properly format pack checksums in PackFile.idx()
Change-Id: Id805850dbe9a3d633168f3056e06ddeafd86f961
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit a33e4dc58a)
2019-03-06 02:36:38 +01:00
Matthias Sohn e8bd9556c0 Cancel gc if thread was interrupted
see
https://groups.google.com/d/msg/repo-discuss/oDB2rl3doDc/tFEh5Xt0CAAJ

Change-Id: Ia6d4631c64e065d8b9b09e0b45e7a9ea8ac3f41d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 882fed0d96)
2019-03-06 02:36:38 +01:00
Luca Milanesio daefa69502 PackFile: report correct message for checksum mismatch
When the packfile checksum does not match the expected one
report the correct checksum error instead of reporting that
the number of objects is incorrect.

Change-Id: I040f36dacc4152ae05453e7acbf8dfccceb46e0d
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 436c99ce59)
2019-03-06 02:36:38 +01:00
David Pursehouse e6fd4732d0 ObjectDirectory: Clean up logging
Externalize the message and log the pack file with absolute path.

Change-Id: I019052dfae8fd96ab67da08b3287d699287004cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit 9665d86ba1)
2019-03-06 02:36:37 +01:00
Luca Milanesio baf1bb20d0 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>
(cherry picked from commit 962babc4b2)
2019-03-06 02:36:37 +01:00
Matthias Sohn 997d785418 Fix error log message in ObjectDirectory.handlePackError()
Change-Id: I154f392ad025c4b642eb1123d375a0afaa853885
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-04 13:51:12 +01:00
Matthias Sohn a33e4dc58a Properly format pack checksums in PackFile.idx()
Change-Id: Id805850dbe9a3d633168f3056e06ddeafd86f961
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-04 13:28:40 +01:00
Matthias Sohn 882fed0d96 Cancel gc if thread was interrupted
see
https://groups.google.com/d/msg/repo-discuss/oDB2rl3doDc/tFEh5Xt0CAAJ

Change-Id: Ia6d4631c64e065d8b9b09e0b45e7a9ea8ac3f41d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-03 18:35:04 +01:00
Luca Milanesio 436c99ce59 PackFile: report correct message for checksum mismatch
When the packfile checksum does not match the expected one
report the correct checksum error instead of reporting that
the number of objects is incorrect.

Change-Id: I040f36dacc4152ae05453e7acbf8dfccceb46e0d
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-03 17:52:33 +01:00
David Pursehouse 9665d86ba1 ObjectDirectory: Clean up logging
Externalize the message and log the pack file with absolute path.

Change-Id: I019052dfae8fd96ab67da08b3287d699287004cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-03 13:15:19 +09: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
Matthias Sohn fafad4196d Prepare 5.1.6-SNAPSHOT builds
Change-Id: If3313d602aa57cfa031ba2c9ec03bd51b464dc19
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-27 01:35:30 +01:00
Matthias Sohn 510011b05c JGit v5.1.5.201812261915-r
Change-Id: I249a440d1ca1c997343da942ae55fcb27a645b92
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-27 01:16:15 +01:00
Jonathan Nieder 53ab1188d5 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  UploadPack: Avoid calling AdvertiseRefsHook twice

Change-Id: Ie9ce67921e38fff8338a148c4d9f2776be01d0b0
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-12-26 13:24:26 -08:00
Jonathan Nieder c961e2d773 UploadPack: Avoid calling AdvertiseRefsHook twice
The AdvertiseRefsHook can be called twice if the following conditions
hold:

 1. This AdvertiseRefsHook doesn't set this.refs.
 2. getAdvertisedOrDefaultRefs is called after getFilteredRefs.

For example, this can happen when fetchV2 is called after lsRefsV2
when using a stateful bidirectional transport.

The second call does not accomplish anything useful.  Guard it with
'if (!advertiseRefsHookCalled)' to avoid wasted work.

Reported-by: Jonathan Tan <jonathantanmy@google.com>
Change-Id: Ib746582e4ef645b767a5b3fb969596df99ac2ab5
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-12-26 13:19:01 -08:00
Matthias Sohn d14209e81b Prepare 5.1.5-SNAPSHOT builds
Change-Id: I3eeb24b01a4f955e7e933238defb42635ebfec7d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-26 00:57:01 +01:00
Matthias Sohn c93aec2b73 JGit v5.1.4.201812251853-r
Change-Id: I30ba167bcd8144074553d7446a45fa6be19584fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-26 00:53:51 +01:00
Jonathan Nieder fcafdcc404 UploadPack: Filter refs used for want-ref resolution
In the longer term, we can add support for this to the
RequestValidator interface.  In the short term, this is a minimal
band-aid to ensure any refs the client requests are visible to the
client.

Change-Id: I0683c7a00e707cf97eef6c6bb782671d0a550ffe
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-26 00:40:00 +01:00
Jonathan Nieder 1638a2fce8 UploadPack: Defer want-ref resolution to after parsing
ProtocolV2Parser explains:

  // TODO(ifrade): This validation should be done after the
  // protocol parsing. It is not a protocol problem asking for an
  // unexisting ref and we wouldn't need the ref database here.

Do so.  This way all ref database accesses are in one place, in the
UploadPack class.

No user-visible change intended --- this is just to make the code
easier to manipulate.

Change-Id: I68e87dff7b9a63ccc169bd0836e8e8baaf5d1048
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-26 00:39:44 +01:00
Matthias Sohn 25deb30460 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Call AdvertiseRefsHook for protocol v2
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Icdc212bf5be2485d0f8028acf6c62fb8531d0e3c
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 23:58:53 +01:00
Masaya Suzuki 8eecb4f8b7 Call AdvertiseRefsHook for protocol v2
AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit.
If this hook is not called, then all refs are treated as visible.

In protocol v2, the hook is not called, causing the server to advertise
all refs.  This bug was introduced in v5.0.0.201805221745-rc1~1^2~9
(Execute AdvertiseRefsHook only for protocol v0 and v1, 2018-05-14).

Even before then, the hook was not called in requests after the
capability advertisement, so in transports like HTTP that do not retain
state between round-trips, the server would advertise all refs in
response to an ls-refs (ls-remote) request.

Fix both cases by using getAdvertisedOrDefaultRefs to retrieve the
advertised refs in lsRefs, ensuring the hook is called in all cases that
use its result.

[jn: backported to stable-5.0; split out from a larger patch that also
 fixes protocol v0; avoided filtering this.refs by ref prefix]

Change-Id: I64bce0e72d15b90baccc235c067e57b6af21b55f
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 23:36:11 +01:00
Matthias Sohn 9caa94239a Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Ie81284ca6d580b0712c49eec610393d0c0c50203
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 23:27:13 +01:00
Matthias Sohn 23e4765a65 Prepare 4.11.7-SNAPSHOT builds
Change-Id: I97dc0f4aeb51c2084f40531ceac84e90bf70608d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 01:08:03 +01:00
Matthias Sohn cc76de549a JGit v4.11.6.201812241910-r
Change-Id: I21bfe7a76450184bce43cbe8ebcaa7891e4b12ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 00:56:54 +01:00
Matthias Sohn affbb99271 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I937e9a4547fc10e4de7c887163022d1ab0322d64
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 00:54:15 +01:00
Matthias Sohn 60a606a261 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I2e499f34b1c481af794fa9325b0dfebaccdf3cb0
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 00:41:41 +01:00
Matthias Sohn 8f1fd09bea Prepare 4.9.9-SNAPSHOT builds
Change-Id: I0f7238ce8f79063a410c85701020ffce2b1234cf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 00:10:49 +01:00
Matthias Sohn 67af2d46dd JGit v4.9.8.201812241815-r
Change-Id: Ic75e4611cce396b186680bc962f0c73b2ee5fff1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-25 00:01:29 +01:00
Matthias Sohn 3dd3fe9ea4 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Ib44e314a68bca2349b45f4937257aa1298c8d74b
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 23:36:29 +01:00
Matthias Sohn a65ce1bfd1 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I68a21067705b580b40840f8039001ff1e5273c15
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 23:27:25 +01:00
Matthias Sohn 391371cad2 Prepare 4.7.8-SNAPSHOT builds
Change-Id: Ic4ab4aae6d87392d1a5a8bbda06384b7a5b64182
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 23:16:19 +01:00
Matthias Sohn 4d32049bb3 JGit v4.7.7.201812240805-r
Change-Id: I57b6001b1fbd6042299ccd4dd7d70765a46ea10b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 13:50:12 +01:00
Matthias Sohn 193a164925 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: If637694f80dbd1e774d60c672fe78a6500650bb8
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 13:25:31 +01:00
Matthias Sohn 4ad74d2f9b Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I0fd67ddd9c4966c20d82cdfe78b2f9d4898b4665
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 12:09:39 +01:00
Matthias Sohn ce76f773f8 Prepare 4.5.6-SNAPSHOT builds
Change-Id: I57c55187ada6d824b94a17f5a79a5bcff61f9ee9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 12:00:26 +01:00
Matthias Sohn 40366c1cf5 JGit v4.5.5.201812240535-r
Change-Id: I6e89e937c08757887967d91afb39cfbe8372d6b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 11:21:27 +01:00
Masaya Suzuki 61f0bd54d0 Call AdvertiseRefsHook before validating wants
AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit.
If this hook is not called, then all refs are treated as visible,
causing the server to serve commits reachable from branches the client
should not be able to access, if asked to via a request naming a guessed
object id.

This bug was introduced in v2.0.0.201206130900-r~123 (Modify refs in
UploadPack/ReceivePack using a hook interface, 2012-02-08).  Stateful
bidirectional transports are not affected.

Fix it by moving the AdvertiseRefsHook call to
getAdvertisedOrDefaultRefs, ensuring the hook is called in all cases.

[jn: backported to stable-4.5 by splitting out tests and the protocol v2
 specific parts]

Change-Id: I159f396216354f2eda3968d17802e166d8c8ec2d
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-12-24 10:58:43 +01:00
David Pursehouse f4fc6404ba BasePackConnection: Check for expected length of ref advertisement
When a server sends a ref advertisement using protocol v2 it contains
lines other than ref names and sha1s.  Attempting to get the sha1 out
of such a line using the substring method can result in a SIOOB error
when it doesn't actually contain the sha1 and ref name.

Add a check that the line is of the expected length, and subsequently
that the extracted object id is valid, and if not throw an exception.

Change-Id: Id92fe66ff8b6deb2cf987d81929f8d0602c399f4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 11:41:02 +09:00
David Pursehouse 2269669fb1 TransferConfig: Make constructors public
UploadPack has a setTransferConfig method which allows to set the
transfer config, however since the constructors of TransferConfig
have the default package visibility it is not possible for any
application using UploadPack, for example Gerrit, to actually set
a transfer config.

Make the constructors public. This is consistent with the public
constructors for example on PackConfig.

Change-Id: I07080255838421871403b2b2bcc294aa8f621c57
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-12-20 08:37:45 +09:00
David Pursehouse 9372cf496f Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 20:01:11 +09:00
David Pursehouse 28f0ef8509 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 19:51:01 +09:00
Matthias Sohn df6263644b Fix DescribeCommand with multiple match options
when multiple match options are given in git describe the result must
not depend on the order of the match options. JGit wrongly picked the
first match using the match options in the order they were defined. Fix
this by concatenating the streams of matching tags for all match options
and then choosing the first match on the concatenated stream sorted in
tie break order.

See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt

Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-26 18:49:30 +01:00
Håvard Wall f9de917547 Fix git-describe tie-breakers
Correct behaviour as git 1.7.1.1 is to resolve tie-breakers to choose
the most recent tag.

https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.1.1.txt:
* "git describe" did not tie-break tags that point at the same commit
   correctly; newer ones are preferred by paying attention to the
   tagger date now.

Bug: 538610
Change-Id: Ib0b2a301997bb7f75935baf7005473f4de952a64
Signed-off-by: Håvard Wall <haavardw@gmail.com>
2018-11-09 08:54:44 +01:00
Matthias Sohn b65e247568 Prepare 5.1.4-SNAPSHOT builds
Change-Id: Iee86860f3b4eb9f4af818c60342fd29465c0474c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 10:39:16 +02:00
Matthias Sohn cf24983b23 JGit v5.1.3.201810200350-r
Change-Id: Ib2c5a79d4fdf77680b7b65652fc3659527df27ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 09:50:16 +02:00
Matthias Sohn 9b6d30f2c1 Prepare 4.11.6-SNAPSHOT builds
Change-Id: Ic823775aad59530f516602e7e848474d65763314
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 02:08:35 +02:00
Matthias Sohn 92aca6195d JGit v4.11.5.201810191925-r
Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:27:52 +02:00
Matthias Sohn 7ae004509c Prepare 4.9.8-SNAPSHOT builds
Change-Id: Iab7b0f2a21a76f801a83fbeb54f09d1525878f4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:10:02 +02:00
Matthias Sohn 97534056fc JGit v4.9.7.201810191756-r
Change-Id: Ib980731eb9ec7f4c92deac9b4cf2f7a994d670c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:58:47 +02:00
Matthias Sohn 97b62cf9dd Update API problem filter
Change-Id: Iba8650900d3936edccbe30de9d3eafd4f9e0dba6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:54:38 +02:00
Matthias Sohn d6c587faef Prepare 4.7.7-SNAPSHOT builds
Change-Id: I131e40cbbf32bc75d2ed24ca31ba3613a3bbca25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:27:47 +02:00
Matthias Sohn b811e4fc51 JGit v4.7.6.201810191618-r
Change-Id: Iaee27d5e2de016240f1a0940653fef82c6044a1d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:18:38 +02:00
Matthias Sohn 2674bec32b Update API problem filter
Change-Id: I66c0c490bb66adafac5d670d2d9571f1674a281e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:15:39 +02:00
Saša Živkov b6e2800560 ssh: Prefer algorithms of the known host keys
JSch prefers ssh-rsa key type. When the remote server supports ssh-rsa
key type then this key type will be used even if the known_hosts file
contains a host key for that host, but with different key type.
This caused an unexpected UnknownHostKey error.

To fix the issue first scan the known_hosts, the HostKeyRepository in
JSch API, for any already existing host keys for the target host and
modify the default session settings to prefer their algorithms. However,
do this only if there is no HostKeyAlgorithms setting active.

Change-Id: I236df2a860ddd9289a0a820ddf09c2dea3673d36
2018-10-18 11:59:16 +02:00
David Pursehouse 33744a2dfe Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs

Change-Id: I24417e4ebbba31f7ff6896d585ef807327411392
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:18:03 +09:00
David Pursehouse 27f7a590d1 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs

Change-Id: I1c077e8f3530ac717b1603d3307fd15d4335b8fe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:16:55 +09:00
David Pursehouse 2db49bc679 Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
Change-Id: If9cb0de7a0e7bd95eac7daeee140a18385192a48
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:14:57 +09:00