aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * | Include filekey file attribute when comparing FileSnapshotsMatthias Sohn2019-05-221-9/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). Some filesystems expose unique file identifiers, e.g. inodes in Posix filesystems which are named filekeys in Java's BasicFileAttributes. Use them as another means to detect file modifications based on stat information. Running git gc on a repository yields a new packfile with the same id as a packfile which existed before the gc if these packfiles contain the same set of objects. The content of the old and the new packfile might differ if a different PackConfig was used when writing the packfile. Considering filekeys in FileSnapshot may help to detect such packfile modifications. Bug: 546891 Change-Id: I711a80328c55e1a31171d540880b8e80ec1fe095 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | Measure file timestamp resolution used in FileSnapshotMatthias Sohn2019-05-223-11/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FileSnapshot.notRacyClean() assumed a worst case filesystem timestamp resolution of 2.5 sec (FAT has a resolution of 2 sec). Instead measure timestamp resolution to avoid unnecessary IO caused by false positives in detecting the racy git problem caused by finite filesystem timestamp resolution [1]. Cache the measured resolution per FileStore since timestamp resolution depends on the respective filesystem type. If timestamp resolution cannot be measured or fails due to an exception fallback to the worst case FAT timestamp resolution and avoid caching this value. Add a 10% safety margin in FileSnapshot.notRacyClean(), though running FsTest.testFsTimestampResolution() 1000 times which is not using a safety margin didn't fail on Mac using APFS and Java 8, 11, 12. Measured Java file timestamp resolution: [2] [1] https://github.com/git/git/blob/master/Documentation/technical/racy-git.txt [2] https://docs.google.com/spreadsheets/d/1imy0y6WmRqBf0kjCxzxj2X7M50eIVfa7oaUIzEOHmjo Bug: 546891 Change-Id: I493f3b57b6b306285ffa7d392339d253e5966ab8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | Fix FileSnapshot's consideration of file sizeMatthias Sohn2019-05-221-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix equals() and hashCode() methods to consider size * fix toString() to show size Change-Id: I5485db55eda5110121efd65d86c7166b3b2e93d0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | Merge branch 'stable-5.3' into stable-5.4David Pursehouse2019-05-241-1/+1
|\| | | | | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: SystemReader: Respect passed-in parent when no system config is present Change-Id: I758ed0c2a3527ffcf6255158a49090aba090e942 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | | SystemReader: Respect passed-in parent when no system config is presentDave Borowitz2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default implementation of openSystemConfig has special handling for when the FS returns null from getGitSystemConfig: it should return a "real" FileBasedConfig instance that never actually tries to load a file. However, this codepath was not respecting the passed-in parent config. Change-Id: Id0bcdc93bb42f9ebe3f5ee4c6b4be8863e0133f9
* | | | ReachabilityCheckers: @since 5.4Ivan Frade2019-05-223-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new ReachabilityChecker interface and its implementations are marked as @since 5.5, but they will make it to the 5.4 release. Change-Id: I88c31b3300ccf35d18c35faddb2517f0a57bdcfd Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | GPG: check that the key found is a signing keyThomas Wolf2019-05-212-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Throw an exception if not. Change-Id: I60f36b271d5f44c6dc475302b169cb5b8a1e3945 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | GPG: use key fingerprint suffix to compare id for signing keyThomas Wolf2019-05-211-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check whether the value of the git config user.signingKey is a suffix of the full fingerprint of the key. This was already used for finding keys in secring.gpg, but not in pubring.kbx. This mechanism allows a user to use any unique suffix to identify keys; to avoid needless collisions it's recommended to use at least the last 16 characters of the hex representation of the fingerprint, which is the key id.[1] [1] https://tools.ietf.org/html/rfc4880#section-12.2 Bug: 545673 Change-Id: If6fb4879502b6ee4b8c26c21b2714aeac4e4670c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | UploadPack: restore inadvertently deleted lineJonathan Tan2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 7b96bd812e ("UploadPack: Use reachability checker to validate non-advertised wants", 2019-05-16), a "walk.setRetainBody(false);" statement was inadvertently deleted. (An earlier version of this commit had this line in another part of the code and a review comment suggested to move it back here; the line was then deleted from the other part of the code but not readded.) Restore this line. Change-Id: I96ff6106ba9e4eef429388c83e898b3363295f69 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
* | | | Merge changes from topic 'reachability-2'Jonathan Tan2019-05-205-44/+481
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: UploadPack: Use reachability checker to validate non-advertised wants BitmappedReachabilityChecker: Reachability check using bitmaps BitmapCalculator: Get the reachability bitmap of a commit ReachabilityChecker: Default implementation with a RevWalk
| * | | | UploadPack: Use reachability checker to validate non-advertised wantsIvan Frade2019-05-161-44/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In "Reachable commit" request validators, we need to check that a "want" in the request, that hasn't been advertised, is reachable from the refs visible to the user. Current code has intermixed the translation of ObjectIds to RevCommits (and its error handling) with the actual walk, with the delegation to bitmaps in restricted circunstances. Refactor the code to make it "flatter" and more readable. Move ObjectIds to RevCommits translation to its own functions. Use the reachability checker instead of a newly defined walk. Before the non-advertised wants were validated with bitmaps only if any "want" refered to an non-commit. Now they will be validated with bitmaps also if the "wants" refer all to commits. Change-Id: Ib925a48cde89672b07a88bba4e24d0457546baff Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | BitmappedReachabilityChecker: Reachability check using bitmapsIvan Frade2019-05-151-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "basic" reachability check walks the graph starting from the tips marking things as "uninteresting". If the target commit is marked as "uninteresting" it was reached; it is reachable from those tips. This requires a lot of walking and can be solved directly with bitmaps. Most of the time the bitmaps are already calculated or a short walk away. This should improve the performance of reachability checks, for example in Gitiles. Change-Id: I83d33271f58d95d2dc9ed151967b3eda513c99f7 Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | BitmapCalculator: Get the reachability bitmap of a commitIvan Frade2019-05-151-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make reachability checks with bitmaps, we need to get the reachability bitmap of a commit, which is not always precalculated. There is already a class returning such bitmap (BitmapWalker) but it does too much unnecessary work: it calculates ALL reachable objects from a commit (i.e. including trees and blobs), when for reachability the commits are just enough. Introduce BitmapCalculator to get the bitmap of a commit: either because it is precalculated or generating it with a walk only over commits. Change-Id: Ibb6c78affe9eeaf1fa362a06daf4fd2d91c1caea Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | ReachabilityChecker: Default implementation with a RevWalkIvan Frade2019-05-152-0/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is common to check if a certain commit is reachable from some starting points. For example gitiles does it to check if a commit is visible to a user based on its permissions. Offer this functionality in JGit. Split the interface as the next commit will introduce an implementation using bitmap indices. Change-Id: I0933b305c8d734f7a64502910ff4d9ef4fc92ae1 Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | Convert to lambda or member referenceCarsten Hammer2019-05-1638-466/+296
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert anonymous inner classes to lambda expressions or member references Bug: 545856 CQ: 19537 Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Use integer depth in PackWriter's DepthAwareVisitationPolicyMatthias Sohn2019-05-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ObjectWalk.getTreeDepth() returns int hence there is no need to use long depths in the lowestDepthVisited map. - Also fix boxing warnings introduced in 0a15cb3a. Change-Id: I6d73b6f41d5d20975d02f376c8588e411eaff0ec Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | SubmoduleWalk#forPath: Clarify that caller must close returned instanceDavid Pursehouse2019-04-291-2/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I25e7913a78c23c030a8c568975ee1044a9973517 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | ConfigConstants: Fix quoting of section names in javadocsDavid Pursehouse2019-04-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace: in the "core section" in the "diff section" in the "merge section" with: in the "core" section in the "diff" section in the "merge" section Change-Id: Ided7bf73e9c8aae4fc4e43d5d5b9f6d7e3066f0a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Silence API errors and add missing @since tags caused by 175e6654Matthias Sohn2019-04-291-1/+2
| | | | | | | | | | | | | | | | Change-Id: If55acad84015f988f1e974bc19c426828b98822b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge branch 'stable-5.3'Matthias Sohn2019-04-297-42/+105
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Prepare 5.3.2-SNAPSHOT builds JGit v5.3.1.201904271842-r Prepare 5.2.3-SNAPSHOT builds JGit v5.2.2.201904231744-r Revert 4678f4b and provide another solution for bug 467631 Apache MINA sshd: make sendKexInit() work also for re-keying Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I8a8671f7767444a77b809bd66a27d776c8332736 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-04-287-42/+105
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.2.3-SNAPSHOT builds JGit v5.2.2.201904231744-r Revert 4678f4b and provide another solution for bug 467631 Apache MINA sshd: make sendKexInit() work also for re-keying Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: Ie7e572ac7e346f21fe0c387d7448be168a9c127a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | Revert 4678f4b and provide another solution for bug 467631Thomas Wolf2019-04-202-16/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making gitlinks and folders match in a tree walk was the wrong approach to fix bug 467631. The problem is that in such a conflict the tree walk may then not descend into the folder. Revert the changes to Paths.java and PathsTest.java from commit 4678f4b. Instead test for the problem case from bug 467631 explicitly in IndexDiff. Add Daniel's test case from bug 545162, and add yet another test case for DiffEntry.scan() that covers the problem originally reported in bug 545162. Bug: 545162 Change-Id: Ie2214c5d5ee32ac6596b621f0f1c7b86d38fa9b7 Also-by: Daniel Veihelmann <daniel.veihelmann@gmail.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| | * | Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-04-205-27/+66
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I76761002eedf360e93d0559942ebc927a40428d6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-5.0' into stable-5.1Matthias Sohn2019-04-205-27/+66
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I685d8a797209bc1b9c1bb9caba40ac8713c6ce5b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2019-04-195-27/+66
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I9b7f9faf3dc584068456f1ae2cacc4ce5137d4ad Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2019-04-185-27/+66
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: Ib2a170e24bddad0e8c9c7be6688269f6318bf30f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2019-04-185-27/+66
| | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I94c9e6300b5f77b185ec6661fa76f0c74a5fc2a9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | * Merge branch 'stable-4.8' into stable-4.9Matthias Sohn2019-04-185-27/+66
| | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: Idaa789e699f1ef568ea957184d0641355d9e3181
| | | | | | | | * Merge branch 'stable-4.7' into stable-4.8stable-4.8Matthias Sohn2019-04-174-28/+68
| | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.7: Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I7984f68833f2d615399296e53cb9a64e5b4ca6ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | | * Merge branch 'stable-4.6' into stable-4.7Matthias Sohn2019-04-164-28/+68
| | | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.6: Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I6ea51dde6608a4163d681aa1ebf710f06da44b21 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | | | * Merge branch 'stable-4.5' into stable-4.6stable-4.6Matthias Sohn2019-04-164-28/+68
| | | | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.5: Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I0b4eaa521ebdea83ab18c05915d691c07a575a7d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | | | | * Remember the cause for invalidating a packfileLuca Milanesio2019-04-114-23/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | | | | | | | | | * Fix pack files scan when filesnapshot isn't modifiedLuca Milanesio2019-04-091-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | | | | | | tree:<depth>: do not revisit tree during packingMatthew DeVore2019-04-161-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a tree is visited during pack and filtered out with tree:<depth>, we may need to include it if it is visited again at a lower depth. Until now we revisit it no matter what the depth is. Now, avoid visiting it if it has been visited at a lower or equal depth. Change-Id: I68cc1d08f1999a8336684a05fe16e7ae51898866 Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | | | | | | | | | tree:<depth> should not traverse overly-deep treesMatthew DeVore2019-04-163-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we are traversing a tree which is too deep, then there is no need to traverse the children. Skipping children is much faster than traversing the possibly thousands of objects which are directly or indirectly referenced by the tree. Change-Id: I6d68cc1d35da48e3288b9cc80356a281ab36863d Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | | | | | | | | | Preliminary support for tree:<depth> filterMatthew DeVore2019-04-164-37/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is used when fetching, and in particular to populate a partial clone or a virtual file system cache as the user navigates. With this, a client can pre-fetch a few directories deeper than only the current directory. depth:0 will omit all trees, and is useful if you only want to fetch the commits of a repository, or fetch just a single tree or blob object. depth:1 will fetch only the root tree of all commits fetched. depth:2 will fetch the root tree and all blobs and tree objects directly referenced from it. depth:3 gets one more level, and so on. depth:# will not filter a blob or tree that is explicitly marked wanted. Bitmaps are disabled when this filter is used. This implementation is quite slow because it iterates over all omitted objects rather than skipping them. This will be addressed in follow-up commits. Change-Id: Ic312fee22d60e32cfcad59da56980e90ae2cae6a Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | | | | | | | | | Merge "Revert "Use try-with-resources in SubmoduleWalk""Jonathan Nieder2019-04-141-12/+14
|\ \ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | Revert "Use try-with-resources in SubmoduleWalk"Jonathan Nieder2019-04-141-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 39b0b51b1253f569888db3578b01708a14360b69. Before that change, SubmoduleWalk.forPath transferred ownership to the caller on success. Afterward, it returns a closed SubmoduleWalk to the caller, which does not appear to be intentional. Change-Id: I9381daac5153706e24fd9117700089848b58c54e
* | | | | | | | | | | | | Use Arrays.asList instead of copying array in a for loopCarsten Hammer2019-04-144-10/+10
|/ / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ie44950f7d2f2f94a0412efb6c274f6e1e31efcd6 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | | | | | Use try-with-resources in SubmoduleWalkCarsten Hammer2019-04-131-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert try finally block to try-with-resources Change-Id: Ifd676a2aba3e926bd2f3b6b8fefd5f63564899ed Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | | | | | Use isEmpty() instead of size()==0 where possibleCarsten Hammer2019-04-1310-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I97f1367a2ea9f1f6146e264c27c3981b842f2a26 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | | | | | Use jdk 5 for loopCarsten Hammer2019-04-137-34/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I708d82acdf194787e3353699c07244c5ac3de189 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | | | | | Join catch sections using multicatchCarsten Hammer2019-04-1324-155/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I1a9112e6a4f938638c599b489cb0858eca27ab91 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | | | | | Process unshallow commits firstMasaya Suzuki2019-04-111-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DepthGenerator marks commits reinteresting for the ones that are reachable from unshallow commits as it walks over the revisions. Those unshallow commits won't necessarily be processed first. Because of this, even if a commit is reachable from unshallow commits, if it's processed before the uninteresting commits, it will not be processed as reinteresting and processed as uninteresting. This causes unshallow git-fetch to be failed. This changes DepthGenerator to process unshallow commits first independent to their depth. This makes uninteresting flag carry work properly. Change-Id: I94378271cf85fbe6302cefc19a167d8cf68e1a69 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* | | | | | | | | | | | Remove unnecessary type specificationsCarsten Hammer2019-04-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Java 7 the diamond operator can be used instead of explicit type parameters. Change-Id: I2dee5fce7afebb1d9088eeaec4484ee58b4fa492 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | | | | | | Use String.isEmpty() instead of comparing to ""Carsten Hammer2019-04-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use of String.equals("") can be replaced with with String.length() == 0 (for JDK5 and lower) or String.isEmpty() (for JDK6 and higher) Change-Id: Id1462d22c5d249485d87993263a9239809e73c55 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | | | | | | Replace usage of String.indexOf with String.contains where possibleCarsten Hammer2019-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Iad3fce891077d85cf2533272c54206c33c37afd8 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | | | | | | Introduce RefDatabase#getTipsWithSha1 to list refs pointing to objectPatrick Hiesel2019-04-082-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add resolveTipSha1, an inverse of exactRef(String ...), to RefDatabase and provide a default implementation that runs in O(n) time where n is the number of refs. For RefTable, provide an implementation that runs in O(log(n)) time. [ifrade@google.com: with tests in InMemoryRepositoryTest to exercise the reftable code path, too] Change-Id: I2811ccd0339cdc1c74b42cce2ea003f07a2ce9e1 Signed-off-by: Patrick Hiesel <hiesel@google.com> Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | | | | | | | | Attach deletion failure reason in FileUtils.delete()Thomas Wolf2019-04-031-11/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use Files.delete() instead of File.delete(), and if there is an exception thrown propagate it unless errors are to be ignored so that the actual deletion failure cause is available to the caller (and will be logged). Change-Id: I5fdb5a4052942437ab365289ad4bb1b563c29456 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | | | | | | | Ignore invalid files in '.gnupg/private-keys-v1.d'Gunnar Wagenknecht2019-04-031-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 545673 Change-Id: I4a2ee1e76f320209b3f8090264d771f1a9da566f Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>