aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | test/tests.bzl: Add docstrings to module and functionIvan Frade2025-02-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downstream validators complain about these docstrings missing. Change-Id: I01c1f40eccc7294a613a75d245a6ca03e14a47e1
* | | | | Merge "test.BUILD: add rule for "external tests""Ivan Frade2025-02-112-2/+9
|\ \ \ \ \
| * | | | | test.BUILD: add rule for "external tests"Ivan Frade2025-02-042-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In exttst/ (external tests?) we have tests that compare results with cgit, but they are not in any bazel rule. Create bazel rules for the tests under exttst/ with a tag "ext". By default, disable that tag when running tests, as these can be slow/problematic due to their dependence to an external tool. bazel test //org.eclipse.jgit.test:all runs the same tests than before.. bazel test --test_tag_filter=ext //org.eclipse.jgit.test:all runs only these external tests. Change-Id: I9231fad11ab5ef550bba2d5aaaef60f1bf2094fe
* | | | | | Merge "Improve configuration of trusting file attributes in FileSnapshot"Matthias Sohn2025-02-081-8/+9
|\ \ \ \ \ \ | |_|/ / / / |/| | | | |
| * | | | | Improve configuration of trusting file attributes in FileSnapshotMatthias Sohn2025-02-061-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FileSnapshot relies on File attributes (which can be retrieved by the stat() function on Unix) to quickly determine if a File was modified without reading file content or listing content of a directory. On NFS this doesn't work reliably due to NFS client caching behavior. Hence we introduced the option core.trustFolderStat to control if FileSnapshot can trust File attributes to ensure we don't miss modifications on NFS. Later more specific options for handling packed and loose refs were added which also support another config value AFTER_OPEN, in addition to ALWAYS and NEVER, which refreshes File attributes by opening a FileInputStream on the file instead of reading its content and then trusts the File attributes of the refreshed File. We discussed in jgit-127 how to extend these options for other scenarios where file attributes are used to detect modifications and came to the conclusion to improve the existing trustXXX config options in the following way: - replace the not well defined "trustFolderStat" option by a general option "trustStat" which allows to configure all these scenarios with a single option - introduce a new enum TrustStat and use it for all scenarios. It has the values - NEVER don't trust File attributes - ALWAYS always trust File attributes - AFTER_OPEN open a FileInputStream on the respective file or folder to ensure its File attributes are refreshed and then trust the refreshed File attributes - INHERIT only used for specific options to signal it should inherit its value from the "trustStat" option - deprecate the old, now unused enums "TrustPackedRefsStat" and "TrustLooseRefStat" - deprecate "trustFolderStat", if set, translate it to the corresponding value of the new option "trustStat" - if both "trustFolderStat" and "trustStat" are configured the value configured for "trustStat" takes precedence and "trustFolderStat" is ignored - add one specific option for each scenario which can override the global setting - add new options "trustLooseObjectStat" and "trustPackStat" which allow to override the global setting for handling of loose objects and pack files - implement option AFTER_OPEN for "trustLooseObjectStat" and "trustPackStat" Bug: jgit-127 Change-Id: I662982258bc4494f146805875e52838394673c8f
* | | | | | Merge changes I0d444b39,I907dabffMatthias Sohn2025-02-061-0/+41
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: Config: add getters for primitive types without default value CommitConfig: fix potential NPE
| * | | | | Config: add getters for primitive types without default valueMatthias Sohn2025-02-061-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which return null if the option is not configured. Change-Id: I0d444b396458f49712e35ef32427dc45ee3f8ec8
* | | | | | midx.PackIndexMerger: Helper to iterate over n-indexesIvan Frade2025-02-033-0/+311
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The multipack index can be build merging the individual pack indexes and handling correctly the duplicates. PackIndexMerger is a utility function that gathers n-indexes and allows to iterate as one with the correct sha1 order. It also precalculates some of the needed metadata (as count of objects without duplicates, or if offsets go over 32 bits). Change-Id: I515b70fffff4489d83834488daf975f85726ea96
* | | | | PackIndex.MutableEntry: new methods to copy its contentsIvan Frade2025-02-031-24/+59
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To build the multipack index, we will iterate over N indexes merging the results in sha1 order. With the current MutableEntry API, we need to create an instance of ObjectId to either compare and/or copy the selected entry to the multi index iterator. Allow MutableEntries to compare to each other without creating any new object, and copy their object id directly to another MutableObjectId. This allows to build other iterators with mutable entries that copy the required memory (few ints) instead of creating short-lived instances of ObjectId. Change-Id: I0c0091420d7c0847c03afdc9e73b566bb4eeba40
* | | | Merge branch 'stable-7.1' into stable-7.2Matthias Sohn2025-02-011-1/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.1: RevWalk: Add an isMergedIntoAnyCommit() method Pack: separate an open/close accounting lock http.server/BUILD: expose servlet resources as target Change-Id: Ie53048a5154a4a40f7c0f9da3b8b829d305ab323
| * | | Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2025-02-011-1/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: RevWalk: Add an isMergedIntoAnyCommit() method Pack: separate an open/close accounting lock http.server/BUILD: expose servlet resources as target Change-Id: I25d3ffe86150d4d9e8a54634145cdbee34ea15fb
| | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2025-02-011-1/+2
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: RevWalk: Add an isMergedIntoAnyCommit() method Pack: separate an open/close accounting lock http.server/BUILD: expose servlet resources as target Change-Id: Icda1b3dbc79c47d5dcc45932fe452fcf66e35657
| | | * RevWalk: Add an isMergedIntoAnyCommit() methodMartin Fick2025-02-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RevWalk had a bulk isMergedIntoAny() method, however it worked only for Refs. Add a similar method which works for RevCommits instead. Unfortunately isMergedIntoAny() cannot be overloaded since java does not include the generic types in Collections of method signatures, so the method name needs to be more complicated to differentiate it from the existing method. Change-Id: I4f8f3a83058a186fafe3b37726e21c5074a6b8e1 Signed-off-by: Martin Fick <mfick@nvidia.com>
* | | | Prepare 7.2.0-SNAPSHOT buildsMatthias Sohn2025-01-292-2/+2
| | | | | | | | | | | | | | | | Change-Id: I646edcba7809ab91d8e0a933796b4b5c81736232
* | | | JGit v7.2.0.202501291320-m2v7.2.0.202501291320-m2Matthias Sohn2025-01-292-2/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I4e4e203c0f6a2463adefd28d3965eaf44bd2e620
* | | | Merge "ArchiveCommandTest: add missing package import"Matthias Sohn2025-01-291-0/+1
|\ \ \ \
| * | | | ArchiveCommandTest: add missing package importMatthias Sohn2024-12-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transitive dependency to org.apache.commons.lang3 was missing when running tests in Eclipse. Change-Id: I364fabc8b76f5401e400e1bf6dcb4fa400ee0494
* | | | | Submodules: Update submodule with deleted worktreeSimon Eder2025-01-291-38/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation throws an exception when a submodule is updated for which the 'gitdir' still exists but the 'worktree' is missing. The current implementation tries to clone the submodule but fails as the 'gitdir' is not empty. The commit adds: - a check if the 'gitdir' is empty - if the 'gitdir' is not empty: - create a new '.git' file linking to the existing 'gitdir' - fetch the submodule - checkout the submodule unconditionally (ignore any configured update mode) - if the submodule is cloned checkout the submodule unconditionally (ignore any configured update mode) This change mimics the behavior of cgit. Bug: jgit-79 Change-Id: Iffc8659d2a04d866a43815c78c7760c0f3d82640
* | | | | Merge changes I5e7323c6,I5e66a512,I0859990fMatthias Sohn2025-01-2817-192/+302
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: RefDatabase#getReflogReader(String): use #exactRef to resolve refName Deprecate Repository#getReflogReader methods Add RefDatabase#getReflogReader methods
| * | | | | RefDatabase#getReflogReader(String): use #exactRef to resolve refNameMatthias Sohn2025-01-278-52/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't accept short ref names anymore which is more predictable. Change-Id: I5e7323c610c68b25facd6f2286456716d8e6cf1a
| * | | | | Deprecate Repository#getReflogReader methodsMatthias Sohn2025-01-2716-185/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead use Repository.getRefDatabase().getReflogReader(). Change-Id: I5e66a512c12e11d0ec3275fffde4adb8483430f2
| * | | | | Add RefDatabase#getReflogReader methodsMatthias Sohn2025-01-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to fix broken abstraction in FileRepository#getReflogReader(String). How to get a ReflogReader depends on the chosen RefDatabase implementation, hence the #getReflogReader methods should be there. This also fixes a bug in FileRepository#getReflogReader(Ref) which didn't work if FileReftableDatabase was used as RefDatabase since it always returned the implementation only suitable for RefDirectory. Change-Id: I0859990f9390ab96596b6c344966c687dfbbf167
* | | | | | Fix ObjectDirectoryTest#testOpenLooseObjectPropagatesIOExceptionsMatthias Sohn2025-01-171-6/+11
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By instrumenting "LooseObjects#open" with print statements (since debugging mocks doesn't work in Eclipse) I found that the constructor "LooseObjects(Config, File)" which defaults "core.trustFolderStat" to "true" isn't used when mocking LooseObjects. Hence "core.trustFolderStat" is in fact "false" in the mocked LooseObjects object. Make this explicit by configuring "trustFolderStat=false" in a real "LooseObjects" object and only mock its method "#getObjectLoader" using a spy. Change-Id: I2f870637db818c2e89c1c2a174bf78bd572a367a
* | | | | FileReftableTest: fix order of arguments when using assertEqualsMatthias Sohn2025-01-061-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expected value is the first argument and the actual value the second argument. Change-Id: I8416cfeaa7a14d0b863658bf133473535647fc57
* | | | | SimpleMergeTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: Ic40473aecb23e22c755a9e041592886fb3c448f9
* | | | | RevCommitParseTest: : use java.time instead of java.util.Date APIMatthias Sohn2024-12-291-10/+15
| | | | | | | | | | | | | | | | | | | | Change-Id: I6cf6ed64b4029001cb5908338b60385804eb9997
* | | | | PushCertificateStoreTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-2/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I600538d0ea7ec4377af331341b8e4e2d51a5a51d
* | | | | ReftableTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-12/+26
| | | | | | | | | | | | | | | | | | | | Change-Id: I63c37a0fb0f6070aba3947903e79d8ebc014f52d
* | | | | ReflogWriterTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: I8e1b82c76403493faa00ec1a30a6d57a695d8573
* | | | | RebaseCommandTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-6/+11
| | | | | | | | | | | | | | | | | | | | Change-Id: Ib5e367c88662defc0471a0487a576bb4b750b778
* | | | | GitLinkMergeTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I9a3f558ff578266a34f45ebf3026c7a093dd6f3c
* | | | | CherryPickTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+5
| | | | | | | | | | | | | | | | | | | | Change-Id: Id0e61babb768d29d6317cc216eeaa5054e5fc869
* | | | | ReflogConfigTest: use java.time instead of java.util.Date APIMatthias Sohn2024-12-291-8/+11
| | | | | | | | | | | | | | | | | | | | Change-Id: I00c63c928ad64a447ad101e01508d917de26bd71
* | | | | ChangeIdUtilTest: use java.time instead of java.util.Date APIMatthias Sohn2024-12-291-6/+6
| | | | | | | | | | | | | | | | | | | | Change-Id: Ideb32d24c78aa8f42546d9098991257ab6f205c4
* | | | | Replace use of deprecated constructor AttributesHandler(TreeWalk)Matthias Sohn2024-12-293-9/+14
| | | | | | | | | | | | | | | | | | | | Change-Id: Ie0b39e0c41bf2827af5f6282ea33ebd21afd47f6
* | | | | GarbageCollectCommandTest: replace deprecated GitDateParserMatthias Sohn2024-12-291-11/+6
| | | | | | | | | | | | | | | | | | | | Change-Id: Ide7f67345fa9a63da16562eed76ca5b2a88b8f8a
* | | | | DfsGarbageCollectorTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-23/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from java.util.Date to java.time APIs. Change-Id: Ifad3fce57f4a742289a5a687a7cf8776fff6bf1c
* | | | | TransportHttpTest: use java.time APIMatthias Sohn2024-12-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: I6d2ff9d0dfb81ca8385f8776e3fa73e090247b79
* | | | | GC tests: use java.time APIMatthias Sohn2024-12-282-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: Ie645d7bf4e958f6602ec106e8c2296d675f62904
* | | | | TestRepositoryTest: use java.time APIMatthias Sohn2024-12-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: Iffcb6ff709cbc101e0700520b8312328ff70b2eb
* | | | | GarbageCollectCommand, GC: use java.time APIMatthias Sohn2024-12-282-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Add GitTimeParser#parseInstant to support this. Change-Id: I3baeafeda5b65421dc94c1045b0ba576d4f79662
* | | | | CommitCommandTest: use java.time APIMatthias Sohn2024-12-251-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: I44947d26086396b0779ce6e1f9b9f30375032388
* | | | | UploadPackTest: Construct PersonIdent with Instant/ZoneIdIvan Frade2024-12-231-21/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away of java.util.Date to the newers java.time API. PersonIdent has deprecated old constructors with long/int for time and tz and provides alternatives with Instant/ZoneId. Use the new constructors in PersonIdent. Change-Id: Ibb32f70818f44fdcc6875e6e706c4c56f85bbabd
* | | | | RelativeDateFormatter: Use Instant instead of dateIvan Frade2024-12-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone suggest to use the more modern java.time.Instant instead of the older Date API. Offer a variant of RelativeDateFormatter#format method for Instants. Change-Id: I536230327ec7b617958191fbe36f98b1294f6d2e
* | | | | CommitTimeRevFilter: Move to java.time APIIvan Frade2024-12-172-2/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate the methods using Date and offer the equivalent as Instant. Keep an int with seconds as internal representation, as it seems more efficient to compare than Instant.before/after. Change-Id: Ie751ab5661c7dafaab58a16c219143b78092f84a
* | | | | Merge "Merge branch 'stable-7.1'"Matthias Sohn2024-12-171-6/+6
|\ \ \ \ \
| * \ \ \ \ Merge branch 'stable-7.1'Matthias Sohn2024-12-151-6/+6
| |\ \ \ \ \ | | |/ / / / | |/| / / / | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.1: FileSnapshot: fix warnings Optionally.Hard: avoid Optional creation on every use, Pack: fix threading bug getting idx Fix potential NPE in TreeWalk#getFilterCommandDefinition Advertise "agent" capability when using protocol v2 FileSnapshot: silence "Stale file handle" exceptions Change-Id: I772dd3b3ce7f27e33c1879ce21ec024cc2f9c52a
| | * | | Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2024-12-151-6/+6
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: FileSnapshot: fix warnings Optionally.Hard: avoid Optional creation on every use, Pack: fix threading bug getting idx Fix potential NPE in TreeWalk#getFilterCommandDefinition Advertise "agent" capability when using protocol v2 FileSnapshot: silence "Stale file handle" exceptions Change-Id: I4fdea7450f27eebfa7ae08002fd51e67b58bf6bb
| | | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-12-151-6/+6
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: FileSnapshot: fix warnings Optionally.Hard: avoid Optional creation on every use, Pack: fix threading bug getting idx Fix potential NPE in TreeWalk#getFilterCommandDefinition Advertise "agent" capability when using protocol v2 FileSnapshot: silence "Stale file handle" exceptions Change-Id: Ibe8bf9ad43cb1e56a5a5e4f4d9d5818334b2550a
| | | | * Advertise "agent" capability when using protocol v2Antonio Barone2024-12-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "agent" capability was not advertised by the server when executing git-upload-pack over protocol v2. This, in turn, prevented the clients from advertising its client agent too, as documented [1]: "The client may optionally send its own agent string by including the agent capability with a value Y (in the form agent=Y) in its request to the server (but it MUST NOT do so if the server did not advertise the agent capability)." When using jgit with Gerrit this had the effect of preventing the logging of the git client agent in the sshd_log. [1] https://git-scm.com/docs/protocol-v2#_agent Bug: jgit-118 Change-Id: Ifb6ea65fde020425920338f7dd9cc683fed6a4a4