aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Prepare 6.10.0-SNAPSHOT buildsMatthias Sohn2024-05-222-2/+2
| | | | Change-Id: I5b6d5c23d504fac386ae04c42b735152fbbcd7ae
* JGit v6.10.0.202405212237-m3v6.10.0.202405212237-m3Matthias Sohn2024-05-222-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I4efb1066ee4146d0455c39cc07879533b8933e43
* Merge changes I12e4d0fd,I082ffb20Matthias Sohn2024-05-162-26/+6
|\ | | | | | | | | | | * changes: Remove unused API problem filters Fix warning "Redundant specification of type arguments <Object>"
| * Fix warning "Redundant specification of type arguments <Object>"Matthias Sohn2024-05-142-26/+6
| | | | | | | | | | | | Use a lambda to fix this and make the code easier to read. Change-Id: I082ffb2073f86d21deb4b51a24e53de9371b765e
* | PatchApplierTest: remove unused importMatthias Sohn2024-05-151-1/+0
| | | | | | | | Change-Id: Ie3ac82a8160c605e27ee3167e3640cd76b1b2a76
* | Allow applying a patch with conflictsPatrick Hiesel2024-05-147-2/+119
|/ | | | | | | | | | | | | | In some settings, we want to let users apply a patch that does not cleanly apply and add conflict markers. In Gerrit, this is useful when cherry picking (via Git patches) from one host to another. This commit takes a simple approach: If a hunk doesn't apply, go to the pre-image line, treat all lines in pre-image length as left side of the conflict and all context and newly added lines as right side of the conflict. Change-Id: I01411d7a32b3f3207097b26231909aae6b835650
* GitDateFormatterTest: Remove printlnsIvan Frade2024-05-021-2/+0
| | | | | | Left overs from https://review.gerrithub.io/c/eclipse-jgit/jgit/+/204984 Change-Id: I169ce2a008ca70267323fa4fb0f1e54981f1ec33
* Bazel: Add support for JDK 21David Ostrovsky2024-05-022-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two failing tests when switching to JDK 21. One failure is related to the changed behaviour related to the locale providers. Adapt `GitDateFormatterTest` to changes in unicode [1]. Second failure related to changed behaviour in URL.openConnection(), see: [2] for more details. Before JDK 20, some of the parsing/validation performed by the JDK built-in URLStreamHander implementations were delayed until URL::openConnection or URLConnection::connect was called. Starting JDK 20, some of these parsing/validations are now performed early, i.e. within URL constructors. IOW, the assumption made in HttpSupport.TesttestMalformedUri() isn't met any more: providing mailformed URI to the URL ctor now throws an exception starting with JDK 20. To rectify the problem, remove the offending test. Test plan: To build with JDK 21 and run the tests locally: $> bazel test --config=java21 //... To build with JDK 21 and run the tests on RBE: $> bazel test --config=remote21 --remote_instance_name=$PROJECT //... [1] https://bugs.openjdk.org/browse/JDK-8304925 [2] https://bugs.openjdk.org/browse/JDK-8293590 Change-Id: I796de67f7945d5f1fa5e8146f4ec8cbe9ac7bd3e
* Fix warning about using raw typeMatthias Sohn2024-04-291-1/+1
| | | | | | | | | | This fixes the warning in UploadPackHandleDeletedPackFileTest. line 116: "Type safety: The method register(Object, Repository) belongs to the raw type TestProtocol. References to generic type TestProtocol<C> should be parameterized." Change-Id: I5a74269f1af7369dd397dd0f1c3cd807c0351367
* [errorprone] Fix pattern ModifiedButNotUsedMatthias Sohn2024-04-292-0/+4
| | | | | | See https://errorprone.info/bugpattern/ModifiedButNotUsed Change-Id: I3bd3f865d50a26af6c594391de5adf35230c984f
* [errorprone] Fix pattern CatchAndPrintStackTraceMatthias Sohn2024-04-291-12/+13
| | | | | | See https://errorprone.info/bugpattern/CatchAndPrintStackTrace Change-Id: I7a6698293d1485f384c275bf7e4dcddc529af4a1
* [errorprone] Fix pattern FutureReturnValueIgnoredMatthias Sohn2024-04-293-8/+8
| | | | | | See https://errorprone.info/bugpattern/FutureReturnValueIgnored Change-Id: I7225fd6388ce70ed5eea9e61b29bd10e1a927acb
* [errorprone] Fix pattern BadImportMatthias Sohn2024-04-294-10/+7
| | | | | | See https://errorprone.info/bugpattern/BadImport Change-Id: I24e5a7a4a64d8b3cf2cc3d394090ce90e849f9f9
* [errorprone] Fix pattern UseCorrectAssertInTestsMatthias Sohn2024-04-291-3/+5
| | | | | | See https://errorprone.info/bugpattern/UseCorrectAssertInTests Change-Id: Iffde63ac795ad30c3e7774764cb8189cb089ed86
* [errorprone] Fix pattern ProtectedMembersInFinalClassMatthias Sohn2024-04-291-1/+1
| | | | | | See https://errorprone.info/bugpattern/ProtectedMembersInFinalClass Change-Id: I5993093ca012f091dfe8ee1f2099b9596c2ee697
* [errorprone] Fix pattern CatchFailMatthias Sohn2024-04-297-10/+17
| | | | | | See https://errorprone.info/bugpattern/CatchFail Change-Id: If1c637a420c4e669a5bdbe4abcefc5c3a2b3a43b
* [errorprone] Fix pattern see UnusedVariableMatthias Sohn2024-04-298-36/+30
| | | | | | See https://errorprone.info/bugpattern/UnusedVariable Change-Id: I75d7602af31ed7d3264d2beab2d159cfbf29e7cb
* [errorprone] Fix pattern LongLiteralLowerCaseSuffixMatthias Sohn2024-04-293-7/+7
| | | | | | See https://errorprone.info/bugpattern/LongLiteralLowerCaseSuffix Change-Id: I139eadef5d66dfed2952ba9e1c91b3fe83259e97
* [errorprone] Fix error pattern JdkObsoleteMatthias Sohn2024-04-294-11/+10
| | | | | | See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
* [errorprone] Fix UnnecessaryParentheses errorsMatthias Sohn2024-04-286-41/+44
| | | | | | See https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: I783fd24286ec1bd55efbf21d05758465f4af87ee
* ResolveMerger: Fix the issue with binary modify-modify conflictsSruteesh2024-04-252-8/+187
| | | | | | | | | | | 1) If the file was marked as binary by git attributes, we should add the path to conflicts if content differs in OURS and THEIRS 2) If the path is a file in OURS, THEIRS and BASE and if it is a binary in any one of them, no content merge should be attempted and the file content is kept as is in the work tree Bug: jgit-14 Change-Id: I9201bdc53a55f8f40adade4b6a36ee8ae25f4db8
* Explain why RacyGitTests may be flaky in some environmentsMatthias Sohn2024-04-201-0/+16
| | | | Change-Id: I5bbd04754f5f29299a7b9a58a3717e3f615199d0
* Merge "Add more tests on rewriting parents in a RevWalk"Ivan Frade2024-04-111-9/+123
|\
| * Add more tests on rewriting parents in a RevWalkMax Haslbeck2024-03-261-9/+123
| | | | | | | | | | | | | | | | | | | | | | Change I4e4ff67fb279edbcc3461496b132cea774fb742f introduced new behaviour that also rewrote parents in a RevWalk if no TreeFilter was set. This led to unexpected behaviour when users were fetching from chromium.googlesource.com. I added a few more tests to better describe the behaviour of RevWalk in regards to rewriting parents. Change-Id: I1a5e5f8a1de9d8dd0e3664918ac010644b3ef87b Signed-off-by: Max Haslbeck <haslbeck@google.com>
* | Merge "MergeAlgorithm: Fix diff3 conflict hunk computation"Ivan Frade2024-04-091-0/+13
|\ \ | |/ |/|
| * MergeAlgorithm: Fix diff3 conflict hunk computationAntonin Delpeuch2024-04-091-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/eclipse-jgit/jgit/issues/38. The previous code computed the boundaries of the base part of conflict hunks using line numbers computed for the 'ours' and 'theirs' revisions, leading to incorrect boundaries. This only affects the presentation of merge conflicts in diff3 mode (which is probably not used a lot yet on Gerrit). Successful merges are unaffected. Change-Id: I173c79bf5797896dc854791d6d05cb3f035726f4 Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu>
* | Merge "DfsGarbageCollectorTest: add test for bitmap index creation"Ivan Frade2024-03-201-1/+67
|\ \
| * | DfsGarbageCollectorTest: add test for bitmap index creationSam Delmerico2024-03-181-1/+67
| |/ | | | | | | Change-Id: Ibb9b2f8fc0f5180728904f243bf372f8a233383d
* | TreeRevFilter: correct changedPathFilter usage for multi-paths inclusionXing Huang2024-03-181-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expected behavior of TreeRevFilter when filtering multiple file paths is to include commits that changed at least one of the given paths; only skipping them if they did not change any of the given paths. The current changedPathFilter utilization logic is skipping a commit if there exists at least one given path that the commit did not change, disregarding the rest of the given paths. Enforcing all given paths to be checked by the changedPathFilter, only skipping a commit if changedPathFilter return negative on all given paths. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: Ib7a9e496b37ec737722fbf33c5d0f05d5d910a8d
* | PathFilterGroup: implement getPathsBestEffort()Xing Huang2024-03-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | getPathsBestEffort() is a method in the TreeFilter class to retrieve file paths specified by the caller. PathFilterGroup do not propagate the paths of their subfilters as it does not implement the getPathsBestEffort() method, resulting in the caller only getting an empty list of paths. Override getPathsBestEffort() in PathFilterGroup to propagate subfilter values. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: I76bf08795360abc0874a7c258636d4f37da35060
* | DfsPackFile: get commitGraph.readChangePaths from repo configXing Huang2024-03-142-0/+66
|/ | | | | | | | | | | By default, CommitGraphLoader reads the readChangedPaths flag from SystemReader ignoring the values set at repo-level. Read the value of the property from the repo configuration and pass it to CommitGraphLoader. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: I34c807714c5a7573769ba9d611457aa107006244
* Prepare 6.10.0-SNAPSHOT buildsMatthias Sohn2024-03-052-60/+60
| | | | Change-Id: Ie728ef9a7d3c6430a5da30f6a61afd2176015748
* Prepare 6.9.1-SNAPSHOT buildsMatthias Sohn2024-03-052-60/+60
| | | | Change-Id: I10f901209be2faa34ebb9355c86c2106bac38ba5
* JGit v6.9.0.202403050737-rv6.9.0.202403050737-rMatthias Sohn2024-03-052-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I70494c0c69ac549dea9b4cf7c5b25e94c1b4b250
* JGit v6.9.0.202403050045-rv6.9.0.202403050045-rMatthias Sohn2024-03-052-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I4c7a6542ad4252c5a9499e69f68650d2026bde40
* Prepare 6.9.0-SNAPSHOT buildsMatthias Sohn2024-03-052-2/+2
| | | | Change-Id: Ifadeead735c8772e58dd4e5c7381b44c5221a295
* JGit v6.9.0.202402281855-rc1v6.9.0.202402281855-rc1Matthias Sohn2024-02-282-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I23d489ccdc257a8c25da4b90dc51d4a8951d320c
* DfsPackFile: Abstract the bitmap loading to support other backendsIvan Frade2024-02-261-0/+41
| | | | | | | | | | | | Current code reads the bitmap index from the pack extension and loads all bitmaps into memory, with its IO and memory cost. We could consider to store the bitmaps on e.g. a database and load them on demand. Abstract the loading of the PackBitmapIndex in an interface that can be implemented with other backends. Change-Id: Ib5f64d05954708ea5325feea7088a8df229b36a5
* Merge "DfsReader#getObjectSize: use size index if possible"Ivan Frade2024-02-231-29/+88
|\
| * DfsReader#getObjectSize: use size index if possibleIvan Frade2024-02-201-29/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | getObjectSize reads the size from the first bytes of the object in the pack, using IO. For blobs and depending on the configuration, the size could be available in the object size index. Try to get the size from the object size index if available. Read from the pack otherwise. Note that GC uses #getObjectSize from the existing pack to write the next object size index. Change-Id: Ia999290c06d061cb53aa8c0a2b28b1a9761567ef
* | Merge "Revert "StartGenerator: Fix parent rewrite with non-default RevFilter""Ivan Frade2024-02-222-113/+0
|\ \
| * | Revert "StartGenerator: Fix parent rewrite with non-default RevFilter"Ivan Frade2024-02-212-113/+0
| |/ | | | | | | | | | | | | | | | | This reverts commit db5ce6b5c24408ae27eb6fa0b6289d51b129baeb. Reason to revert: This change utilizes the RewriteGenerator even in absence of a path, making the walk lengthy. Change-Id: I5ffa6e8fead328191348c1e46828bf8c75ae1e42
* | Merge branch 'stable-6.8'Matthias Sohn2024-02-211-6/+5
|\ \ | |/ |/| | | | | | | | | | | * stable-6.8: Delete org.eclipse.jgit.ssh.apache.agent/bin/.project Allow to discover bitmap on disk created after the packfile Change-Id: I08095dfaefb963876d993383cb35acc6b75d7691
| * Merge branch 'stable-6.7' into stable-6.8Matthias Sohn2024-02-211-6/+5
| |\ | | | | | | | | | | | | | | | | | | | | | * stable-6.7: Delete org.eclipse.jgit.ssh.apache.agent/bin/.project Allow to discover bitmap on disk created after the packfile Change-Id: I01749bae6f46d1a8ebd25b890e667cc092f3a659
| | * Merge branch 'stable-6.6' into stable-6.7Matthias Sohn2024-02-211-6/+5
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.6: Delete org.eclipse.jgit.ssh.apache.agent/bin/.project Allow to discover bitmap on disk created after the packfile Change-Id: I2bbc8c9a4ed45d37fa7ba63b2afd5511b6cf47a2
| | | * Allow to discover bitmap on disk created after the packfileLuca Milanesio2024-02-201-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the bitmap file was created *after* a packfile had been loaded into the memory, JGit was unable to discover them. That happed because of two problems: 1. The PackDirectory.getPacks() does not implement the usual while loop that is scanning through the packs directory as in the other parts of JGit. 2. The scan packs does not look for newly created bitmap files if the packfile is already loaded in memory. Implement the normal packfiles scanning whenever the PackDirectory needs to return a list of packs, and make sure that any reused Pack object would have its associated bitmap properly refreshed from disk. Adapt the assertions in GcConcurrentTest with the rescanned list of Pack from the objects/packs directory. Bug: jgit-15 Change-Id: I2ed576cefd78a0e128b175228a59c9af51523d7b
| * | | Merge branch 'stable-6.7' into stable-6.8Dariusz Luksza2024-02-121-0/+146
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.7: Improve handling of NFS stale handle errors Fix handling of missing pack index file Add tests for handling pack files removal during fetch Change-Id: I409d1dc3354ad65c048d2c40f39071a1207246c6
| | * | Merge branch 'stable-6.6' into stable-6.7Dariusz Luksza2024-02-121-0/+146
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.6: Improve handling of NFS stale handle errors Fix handling of missing pack index file Add tests for handling pack files removal during fetch Change-Id: Ie00984319d68beeffcbdb6bb323fbeb94a118e5c
| | | * Fix handling of missing pack index fileDariusz Luksza2024-01-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As demonstrated in `UploadPackHandleDeletedPackFile.testV2IdxFileRemovedDuringUploadPack` the fetch operation will fail when the pack index file is removed. This is due to a wrapping of `FileNotFoundException` (which is a subclass of `IOExeption`) in an `IOException` at PackIndex L#68. This is then changing the behaviour of error handling in `Pack.file.getBitmapIndex()` where the `FileNotFoundException` is swallowed and allows the fetch process to continue. With FNFE being wrapped in IOE, this blows up and breaks the fetch operation. Simply rethrowing `FileNotFoundException` from `PackFile.open()` fixes the broken fetch operation. This will also mark the whole pack as invalid in the `IOException` handler in `Pack.idx()` method. Change-Id: Ibe321aa1af21d26500e1cb2eb3464cc99a6dbc62 Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com> (cherry picked from commit e0910eda3ea1c474b4cf9b00ac698f739a982f8c)
| | | * Add tests for handling pack files removal during fetchDariusz Luksza2024-01-291-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although this could sound like a corner case, it really can occur out there in the real world. Especially in the Gerrit world where the repositories could be GC'ed on a separate process or system. The `FileNotFoundException` seems to be handled correctly in `PackFile#doOpen` (line 671) and it will mark the pack as invalid. But triggering that code path was not an easy task. First of all, we need to add a new commit to the `master` branch of the test repository after `UploadPack` object is created. Secondly, in the refspec for fetch, commit id instead of "regular" refspec must be used. With both in place, we can see a warning log statement about deleted pack file. And the fetch succeeds! Also, tests for the removal of *.idx and *.bitmap files were added. This unveiled a corner for the *.idx file deletion while fetching, as the test will fail with "Unreachable pack index" IOException only when the HEAD commit is empty. Change-Id: If26c83f9b12993d1ab7d6bad6bd863c29520b062 Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com> (cherry picked from commit ba5adc4ce6f234cb300b0f73a1efdba9bba1b5d8)