aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Add numberOfObjectsSinceBitmap to RepoStatistics" into stable-6.10Matthias Sohn2024-11-201-6/+76
|\
| * Add numberOfObjectsSinceBitmap to RepoStatisticsJacek Centkowski2024-11-201-6/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a numberOfObjectsSinceBitmap that contains the number of objects stored in pack files and as loose objects created since the latest bitmap generation. Note that the existing GcNumberOfPackFilesAfterBitmapStatisticsTest.java was renamed to GcSinceBitmapStatisticsTest.java and extended to cover also this statistic. Change-Id: I8ae1db142ddfcd42a5a1d6da01bc67f695562e0e
* | Merge "Don't fail when trying to prune pack which is already gone" into ↵Luca Milanesio2024-11-201-79/+3
|\| | | | | | | stable-6.10
| * Don't fail when trying to prune pack which is already goneJacek Centkowski2024-11-201-79/+3
| | | | | | | | | | | | | | | | | | | | Update the TestRepository.prunePacked so that it doesn't fail if a pack to be pruned is already gone. It is especially handy when the prunePacked function is called in `TestRepository.packAndPrune` function after the repo moves on after GC was performed. Change-Id: I01b4ddbaddec1fdc24cfbb967e0edfe0de6c4b7c
* | Merge "Support built-in diff drivers for hunk header function names" into ↵Matthias Sohn2024-11-206-0/+331
|\ \ | |/ |/| | | stable-6.10
| * Support built-in diff drivers for hunk header function namesKaushik Lingarkar2024-11-206-0/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regexes defined for each built-in driver will be used to determine the function name for a hunk header. Each driver can specify a list of regexes to negate and match. They can also define pattern compilation flags if needed. These drivers only apply to text files with unified patch type. Following built-in drivers have been added: - cpp - dts - java - python - rust Support for more languages can be added as needed to match the cgit implementation. Change-Id: Ice5430bfed7e4aaf9f00e52e44402479984953c5
* | Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmapJacek Centkowski2024-11-121-7/+7
|/ | | | | | As sugested in I608011462f1. Change-Id: If66226dd7b08ae768413fa614df5dcb6b44dc118
* Add `numberOfPackFilesAfterBitmap` to RepoStatisticsJacek Centkowski2024-11-071-0/+173
| | | | | | | | | | | | | | | | | Introduce a `numberOfPackFilesAfterBitmap` that contains the number of packfiles created since the latest bitmap generation. Notes: * the `repo.getObjectDatabase().getPacks()` that obtains the list of packs (in the existing `getStatistics` function) uses `PackDirectory.scanPacks` that boils down to call `PackDirectory.scanPacksImpl` which is sorting packs prior returning them therefore the `numberOfPackFilesAfterBitmap` is just all packs before the one that has bitmap attached * the improved version of `packAndPrune` function (one that skips non-existent packfiles) was introduced for testing Change-Id: I608011462f104fc002ac527aa405f492a8a4b0c2
* Add Union merge strategy supportNasser Grainawi2024-11-042-0/+373
| | | | | | | | | Allow users to specify the `union` strategy in their .gitattributes file in order to keep lines from both versions of a conflict [1]. [1] https://git-scm.com/docs/gitattributes.html#Documentation/gitattributes.txt-union Change-Id: I74cecceb2db819a8551b95fb10dfe7c2b160b709
* RepoProject: read the 'dest-branch' attribute of a projectKaushik Lingarkar2024-07-081-0/+30
| | | | | | | | | | | The manifest spec [1] defines a "dest-branch" attribute. Parse its value and store it in the RepoProject. Also, create a getter/setter for dest-branch. [1] https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md#Element-project Change-Id: I8ad83b0fec59d2b0967864e4de4fefde4ab971ff (cherry picked from commit 47fd412affd8d7578606ae9b3015a911b71b13ed)
* RepoCommand: Copy manifest upstream into .gitmodules ref fieldIvan Frade2024-07-082-0/+133
| | | | | | | | | | | | | | Project entries in the manifest with a specific sha1 as revision can use the "upstream" field to report the ref pointing to that sha1. This information is very valuable for downstream tools, as they can limit their search for a blob to the relevant ref, but it gets lost in the translation to .gitmodules. Save the value of the upstream field when available/relevant in the ref field of the .gitmodules entry. Change-Id: I14a2395925618d5e6b34be85466e32f5ef8fbf6e (cherry picked from commit 48465f84014904edddcdd48258c67bc19555d4c3)
* RepoProject: read the "upstream" attribute of a projectIvan Frade2024-07-081-0/+39
| | | | | | | | | | | | | | | | | | The manifest spec [1] defines the "upstream" attribute: "name of the git ref in which a sha1 can be found", when the revision is a sha1. The parser is ignoring it, but RepoCommand could use it to populate the "ref=" field of pinned submodules. Parse the value and store it in the RepoProject. RepoProject is public API and the current constructors are not telescopic, so we cannot just add a new constructor with an extra argument. Use plain getter/setters.j [1] https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md#Element-project Change-Id: Ia50b85b95bfd3710f9fbda2050be5950dd686941 (cherry picked from commit 1dd6324d4b4d9596813b18a44e315295f559ea12)
* Prepare 6.10.1-SNAPSHOT buildsMatthias Sohn2024-06-042-60/+60
| | | | Change-Id: I3384e7405cadf063e7b0dd25468a8651c45628ac
* JGit v6.10.0.202406032230-rv6.10.0.202406032230-rMatthias Sohn2024-06-042-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Id188a6cdc2db63c961f0b9338e6ae56d58853dff
* JGit v6.10.0.202406032110-rv6.10.0.202406032110-rMatthias Sohn2024-06-032-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I3128b2e4bbbed97adde90f7a47e15175e63e97f5
* Prepare 6.10.0-SNAPSHOT buildsMatthias Sohn2024-06-022-2/+2
| | | | Change-Id: I64f6d6a0599cbab462dca236c00e6f3314b2a810
* JGit v6.10.0.202405290101-rc1v6.10.0.202405290101-rc1Matthias Sohn2024-05-292-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Ie3d08213e00fcfe1fc34a39021dd99f27e0abc1f
* JGit v6.10.0.202405282244-rc1v6.10.0.202405282244-rc1Matthias Sohn2024-05-292-2/+2
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Ia525790e0b4c9011b29768d2b9727cb48b21ba84
* PatchApplier.Result.Error: mark fields finalMatthias Sohn2024-05-281-8/+6
| | | | | | | Fields of an Error instance shouldn't be modifiable after its creation. Adapt tests which were setting hh to null to skip asserting it. Change-Id: I0f55c1d5cd529aa510029054e6f05bd2637d1bca
* PatchApplier: Set a boolean on the result if conflict markers were addedPatrick Hiesel2024-05-271-2/+2
| | | | | | | This will let callers show a different error message or mark the state as conflicting. Change-Id: Id8eea614b6b8d54c62b49ffbac90599e6f4c5efa
* PatchApplier: Add test for conflict markers on a deleted filePatrick Hiesel2024-05-272-0/+20
| | | | | | | | For deleted files, we want to keep erroring out even if conflicts are allowed for the apply patch logic. The resulting file would otherwise only consist of the patch. Change-Id: I18defa627ad2223a3a917d2b0ee4189396732533
* 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