aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
Commit message (Collapse)AuthorAgeFilesLines
* Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolutionMatthias Sohn2019-07-171-0/+8
| | | | | | Bug: 548682 Change-Id: I48840d3a68cf1db92c056d218a0d5ed0b9ea4c45 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add support for nanoseconds and microseconds for Config#getTimeUnitMatthias Sohn2019-07-111-0/+12
| | | | Change-Id: I0a5828438810dd23790cba52d7ae2e055c6a3fc9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Delete unused FileTreeIteratorWithTimeControlMatthias Sohn2019-07-112-177/+0
| | | | | | | The only usage of this test iterator was removed in df637928d. Hence delete this iterator and associated test. Change-Id: I47710133ec3edc675c21db210960c024982668c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* FileSnapshot#equals: consider UNKNOWN_SIZEHan-Wen Nienhuys2019-07-091-0/+11
| | | | | | | | | | | | | | | | Add a unittest. In commit I5485db55 ("Fix FileSnapshot's consideration of file size"), the special casing of UNKNOWN_SIZE was forgotten. This change, together with I493f3b57b ("Measure file timestamp resolution used in FileSnapshot") introduced a regression that would occasionally surface in Gerrit integration tests marked UseLocalDisk, with the symptom that creating the Admin user in NoteDb failed with a LOCK_FAILURE. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: I7ffd972581f815c144f810481103c7985af5feb0
* Fix RacyGitTests#testRacyGitDetectionMatthias Sohn2019-07-031-11/+26
| | | | | | | | | | | | | | This test case assumed file system timestamp resolution of 1 second. On filesystems with a finer resolution this test fails since the index entry is only smudged if the file index entry's lastModified and the lastModified of the git index itself are within the same filesystem timer tick. Fix this by ensuring that these timestamps are identical which should work for any filesystem timer resolution. Bug: 548188 Change-Id: Id84d59e1cfeb48fa008f8f27f2f892c4f73985de Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Change RacyGitTests to create a racy git situation in a stable wayMasaya Suzuki2019-06-191-29/+24
| | | | | | | | | | | By using File#setLastModified, we can create a racy git situation stably. Tested with --runs_per_test=100 Bug: 526111 Change-Id: I60b3632d353e19f335668325aa603640be423f58 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8David Pursehouse2019-06-196-13/+18
| | | | | Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix non-deterministic hash of archives created by ArchiveCommandMatthias Sohn2019-06-191-8/+183
| | | | | | | | | | | | | | | | Archives created by the ArchiveCommand didn't produce deterministic archive hashes. For RevCommits RevWalk.parseTree returns the root tree instead of the RevCommit hence retrieving the commit's timestamp didn't work. Instead use RevWalk.parseAny and extract the tree manually. Archive entries store timestamps with 1 second resolution hence we need to wait longer when creating the same archive twice and compare archive hashes. Otherwise hash comparison in tests wouldn't fail without this patch. Bug: 548312 Change-Id: I437d515de51cf68265584d28a8446cebe6341b79 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Make inner classes static where possibleDavid Pursehouse2019-06-177-9/+10
| | | | | | | | | | | | | | As reported by Error Prone: An inner class should be static unless it references members of its enclosing class. An inner class that is made non-static unnecessarily uses more memory and does not make the intent of the class clear. See https://errorprone.info/bugpattern/ClassCanBeStatic Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> (cherry picked from commit ee40efcea44bc0c9a28afe29a80c87636947484e)
* Test detecting modified packfilesChristian Halstrick2019-06-051-11/+222
| | | | | | | | | | | | | Test that JGit detects that packfiles have changed even if they are repacked multiple times in one tick of the filesystem timer. Test that this detection works also when repacking doesn't change the length or the filekey of the packfile. In this case where a modified file can't be detected by looking at file metadata JGit should still detect too fast modification by racy git checks and trigger rescanning the pack list and consequently rereading of packfile content. Change-Id: I67682cfb807c58afc6de9375224ff7489d6618fb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Extend FileSnapshot for packfiles to also use checksum to detect changesMatthias Sohn2019-06-041-0/+143
| | | | | | | | | | | | | | If the attributes of FileSnapshot don't detect modification of a packfile read the packfile's checksum and compare it against the checksum cached in the loaded packfile. Since reading the checksum needs less IO than reloading the complete packfile this may help to reduce the overhead to detect modficiation when a gc completes while ObjectDirectory scans for packfiles in another thread. Bug: 546891 Change-Id: I9811b497eb11b8a85ae689081dc5d949ca8c4be5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add FileSnapshot test testing recognition of file size changesMatthias Sohn2019-05-291-0/+17
| | | | Change-Id: Ibcd76a5e6e4183ada0be1d4436ce957243f2094d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Capture reason for result of FileSnapshot#isModifiedMatthias Sohn2019-05-291-0/+7
| | | | | | | | | | | | | | | This allows to verify the expected behavior in FileSnapshotTest#testSimulatePackfileReplacement and enables extending FileSnapshot for packfiles to read the packfile's checksum as another criterion to detect modifications without reading the full content. Also add another field capturing the result of the last check if lastModified was racily clean. Remove unnecessary determination of raciness in the constructor. It was determined twice in all relevant cases. Change-Id: I100a2f49d7949693d7b72daa89437e166f1dc107 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Skip FileSnapshotTest#testSimulatePackfileReplacement on WindowsMatthias Sohn2019-05-291-0/+3
| | | | | | NTFS does not support FileKey hence ignore this test on Windows. Change-Id: I7b53a591daa5e03eb5e401b5b26d612ab68ce10d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix FileSnapshotTest.testNewFileNoWait() to match its javadocMatthias Sohn2019-05-271-2/+0
| | | | | | | testNewFileNoWait() was identical to testNewFileWithWait() but claims it doesn't wait at all. Hence remove the waits. Change-Id: I49b8ca5cb49a43c55fe61870c18c42f32fb4b74d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Include filekey file attribute when comparing FileSnapshotsMatthias Sohn2019-05-221-0/+28
| | | | | | | | | | | | | | | | | | | | | | 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-221-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'stable-5.0' into stable-5.1Matthias Sohn2019-03-211-0/+17
|\ | | | | | | | | | | | | | | * stable-5.0: Fix GC to delete empty fanout directories after repacking Change-Id: I5c0e7d59f137c27e4588f20f4472d3ea450cd59c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2019-03-211-0/+17
| |\ | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Fix GC to delete empty fanout directories after repacking Change-Id: Idce894a24e126e0fbe7bc9b6a3c64318f1a8eb75 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2019-03-211-0/+17
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Fix GC to delete empty fanout directories after repacking Change-Id: I7118b9c668dcbb0f5435cc613e964c557bfebf01 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2019-03-211-0/+17
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Fix GC to delete empty fanout directories after repacking Change-Id: Ibdbfe08eb290286fa738010bad1c604e857885cd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Fix GC to delete empty fanout directories after repackingMatthias Sohn2019-03-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | Merge branch 'stable-4.11' into stable-5.0David Pursehouse2019-03-061-0/+52
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | * | | Merge branch 'stable-4.10' into stable-4.11David Pursehouse2019-03-061-0/+52
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | | * | Merge branch 'stable-4.9' into stable-4.10David Pursehouse2019-03-061-0/+52
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | | | * Cancel gc if thread was interruptedMatthias Sohn2019-03-061-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 882fed0d96c533513c43ae77aaff9cc07b94012c)
* | | | | Cancel gc if thread was interruptedMatthias Sohn2019-03-031-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see https://groups.google.com/d/msg/repo-discuss/oDB2rl3doDc/tFEh5Xt0CAAJ Change-Id: Ia6d4631c64e065d8b9b09e0b45e7a9ea8ac3f41d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | UploadPack: Defer want-ref resolution to after parsingJonathan Nieder2018-12-261-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | Merge branch 'stable-5.0' into stable-5.1David Pursehouse2018-11-271-16/+39
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * | | | Merge branch 'stable-4.11' into stable-5.0David Pursehouse2018-11-271-16/+39
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | * | | Fix DescribeCommand with multiple match optionsMatthias Sohn2018-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | | Fix git-describe tie-breakersHÃ¥vard Wall2018-11-091-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | Merge branch 'stable-5.0' into stable-5.1Matthias Sohn2018-10-063-2/+210
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Prepare 4.11.5-SNAPSHOT builds JGit v4.11.4.201810060650-r Fix configuration of maven-javadoc-plugin Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options * Fix todos in SubmoduleAddTest Change-Id: I53272081094b8948a40a1ce409af08b6ef330c1e Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | | Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2018-10-063-2/+213
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.5-SNAPSHOT builds JGit v4.11.4.201810060650-r Fix configuration of maven-javadoc-plugin Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options * Fix configuration of maven-javadoc-plugin for site generation Change-Id: Ic6ff8d324867ee41f15a5b890c7eee5092e8453e Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | | Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2018-10-063-2/+213
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Ibd759f5d425f714e79b3137ff8e5b0f989933de0 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-10-063-2/+213
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Ie59e34eb591a827d1ce8e483eec6d390a3c81702 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-4.8' into stable-4.9Matthias Sohn2018-10-063-2/+213
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Ia7a826399d8d5b8a0eb7169b40e98a6f5c207a4c Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-4.7' into stable-4.8Matthias Sohn2018-10-063-3/+214
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.7: Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Id6fabec4d0b682a7e20a46e88cbc05432efca062 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * BaseReceivePack: Validate incoming .gitmodules filesIvan Frade2018-10-051-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main concern are submodule urls starting with '-' that could pass as options to an unguarded tool. Pass through the parser the ids of blobs identified as .gitmodules files in the ObjectChecker. Load the blobs and parse/validate them in SubmoduleValidator. Change-Id: Ia0cc32ce020d288f995bf7bc68041fda36be1963 Signed-off-by: Ivan Frade <ifrade@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * ObjectChecker: Report .gitmodules files found in the packIvan Frade2018-10-051-2/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to validate .gitmodules files, we first need to find them in the incoming pack. Do it in the ObjectChecker stage. Check in the tree objects if they point to a .gitmodules file and report the tree id and the .gitmodules blob id. This can be used later to check if the file is in the root of the project and if the contents are good. While we're here, make isMacHFSGit more accurate by detecting variants of filenames that vary in case. [jn: tweaked NTFS and HFS+ checking; added more tests] Change-Id: I70802e7d2c1374116149de4f89836b9498f39582 Signed-off-by: Ivan Frade <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * SubmoduleAddCommand: Reject submodule URIs that look like cli optionsIvan Frade2018-10-051-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C git versions before 2.19.1, the submodule is fetched by running "git clone <uri> <path>". A URI starting with "-" would be interpreted as an option, causing security problems. See CVE-2018-17456. Refuse to add submodules with URIs, names or paths starting with "-", that could be confused with command line arguments. [jn: backported to JGit 4.7.y, bringing portions of Masaya Suzuki's dotdot check code in v5.1.0.201808281540-m3~57 (Add API to specify the submodule name, 2018-07-12) along for the ride] Change-Id: I2607c3acc480b75ab2b13386fe2cac435839f017 Signed-off-by: Ivan Frade <ifrade@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | | | | Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2018-09-081-4/+5
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Fix atomic lock file creation on NFS Use constant for ".lock" Fix handling of option core.supportsAtomicCreateNewFile GC: Avoid logging errors when deleting non-empty folders Change-Id: Ie86079d9ad76972306bc80e63d8bfe18ae06a0da Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | | | Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-09-081-4/+5
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Fix atomic lock file creation on NFS Use constant for ".lock" Fix handling of option core.supportsAtomicCreateNewFile GC: Avoid logging errors when deleting non-empty folders Change-Id: I32dc651870b7ba7c88de448c7984134b7c99e7e3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * | | Merge branch 'stable-4.8' into stable-4.9Matthias Sohn2018-09-081-4/+5
| | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Fix atomic lock file creation on NFS Use constant for ".lock" Fix handling of option core.supportsAtomicCreateNewFile GC: Avoid logging errors when deleting non-empty folders Change-Id: Id7f68f4e8fb07a21737e3b7090f600507a13bbbe Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * | Merge branch 'stable-4.7' into stable-4.8Matthias Sohn2018-09-081-4/+5
| | | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.7: Fix atomic lock file creation on NFS Use constant for ".lock" Fix handling of option core.supportsAtomicCreateNewFile GC: Avoid logging errors when deleting non-empty folders Change-Id: Ia7a18f69eee173aec9e462c16eee2b0ca4565e76 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * Use constant for ".lock"Matthias Sohn2018-09-071-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry picked from commit 5f27032fb85694a093f827581216d4ffb99db68b) Change-Id: I6bc0e9a910b110418a82d8e574fb2aecc3a31d6a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * | Merge branch 'stable-4.7' into stable-4.8David Pursehouse2018-08-311-17/+0
| | | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.7: Bazel: Use hyphen instead of underscore in external repository names Bazel: Format all build files with buildifier 0.15.0 ChangeIdUtilTest: Remove unused notestCommitDashV Change-Id: I414ade902dc38b696c566dd604000e3d289f3973 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | | | * ChangeIdUtilTest: Remove unused notestCommitDashVDavid Pursehouse2018-08-301-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was never being run. Since it was introduced it was named "notest.." which meant it didn't run with JUnit3, and since it is not annotated @Test it also doesn't run with JUnit4. When compiling with Bazel 0.6.0, error-prone raises an error that the public method is not annotated with @Ignore or @Test. Given that the test has never been run anyway, we can just remove it. Bug: 525415 Change-Id: Ie9a54f89fe42e0c201f547ff54ff1d419ce37864 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | UploadPackTest: Avoid unnecessarily boxing int into IntegerDavid Pursehouse2018-09-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The statement: assertThat(recvStream.available(), is(0)); results in a warning from Eclipse: The expression of type int is boxed into Integer because recvStream.available() returns int, but the hamcrest is() method takes an Integer. Replace it with the equivalent JUnit assertion. Also remove the suppression of another similar warning and fix that in the same way. Change-Id: I6f18b304a540bcd0a10aec7d3abc7dc6f047fe80 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | Parse signature of GPG-signed commitsDavid Turner2018-09-042-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support GPG-signed commits, add some methods which will allow GPG signatures to be parsed out of RevCommit objects. Later, we can add code to verify the signatures. Change-Id: Ifcf6b3ac79115c15d3ec4b4eaed07315534d09ac Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>