aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* 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.0stable-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
| | | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-11-261-0/+42
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: PackDirectory: Filter out tmp GC pack files Test advertised capabilities with protocol V0 and allow*Sha1InWant Align request policies with CGit Pack.java: Recover more often in Pack.copyAsIs2() Change-Id: Ib301efa54aaf2196d764a0fc1f91f652b4d68396
| | | | * Test advertised capabilities with protocol V0 and allow*Sha1InWantpszlazak2024-11-211-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The advertised capabilities with protocol V0 were untested leading to potential regressions when advertising what SHA1 should or should not be on the list of capabilities. Verify that allow-tip-sha1-in-want and allow-reachable-sha1-in-want are properly advertised with the allow*Sha1InWant is set in jgit.config. Change-Id: Id48af2bc19280f2dcb26aa8e8765cde8f2ce7a06 (cherry picked from commit 5583f6a10eafc8c2627e0fb4833cb8ffe422f69a)
* | | | | TestRepository: Deprecate #getDate and use #getInstant insteadIvan Frade2024-12-132-3/+3
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone recomments to use the more modern java.time API instead of the java.util.Date family of classes. This removes all uses of TestRepository#getDate and replace them with getInstant. The method is marked as deprecated and doesn't have any other usages. Change-Id: I84ea63abf781d0d3c7c2724891fd2ef7afc2db1d
* | | | ArchiveCommandTest: add more detailed message if test failedXenoAmess2024-12-131-1/+4
| | | | | | | | | | | | | | | | Change-Id: I05230cd79d5b744bd1b37a2fb5ba69a8ad6bab62
* | | | Merge "RevertCommand: use only first line in revert commit message"Matthias Sohn2024-12-132-4/+16
|\ \ \ \
| * | | | RevertCommand: use only first line in revert commit messageThomas Wolf2024-12-112-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C git uses only the first line of the title paragraph of the reverted commit to build the title of the revert commit. Align the JGit behavior with that. Since git 2.43.0, a revert of a revert uses a title "Reapply "xxx"" instead of "Revert "Revert "xxx""".[1] This is _not_ implemented in this change. [1] https://github.com/git/git/commit/883cb1b8f86d Bug: jgit-117 Change-Id: I030092c6b9447bb738e6d761af5ce50df58cc6d3
* | | | | Merge "PushCertificateIdentTest: Add test for the timezone parsing"Ivan Frade2024-12-121-0/+45
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | PushCertificateIdentTest: Add test for the timezone parsingIvan Frade2024-12-121-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PushCertificateIdent translates the hhmm in the certificate ident to minutes and then back to hhmm when a timezone is needed. This accepts invalid timezones like +0061 (which becomes +0101 (!)). Add test covering these peculiar timezone translations. This will help when porting the PushCertificateIdent to the new java.time API Change-Id: I008648d4e0c977eb3b3135e548d577680cf5f39c
* | | | | Submodules: use relative paths for worktree and gitdirSimon Eder2024-12-113-5/+21
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently absolute paths are used for a submodules 'worktree' and 'gitdir'. This has drawbacks if a git repository containing submodules is copied to a different location. Enable using relative paths when creating a file-based repository. Add optional relative path support to the clone and init commands, and use it in the submodule commands to generate relative paths. The new implementation mimics the cgit behavior which also uses relative paths instead of absolute ones. Bug: jgit-78 Change-Id: I31c5a938d5cbc030d273fc649c94ee0c90b4ce01
* | | | RawParseUtils: Default to UTC in invalid timezonesIvan Frade2024-12-091-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PersonIdent used to translate invalid timezones to UTC [1], but the new java.time code just throws an exception. Also the parsing used happen on demand, but now is done in the constructor, so the exception is thrown even if the timezone is not used at all. Check the parsed timezone and default to UTC if it is out of range. [1] https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getTimeZone-java.lang.String- Change-Id: I90dd7d842ac8f44caef3b76d57375dead76bebde
* | | | Prepare 7.2.0-SNAPSHOT buildsMatthias Sohn2024-11-272-60/+60
|/ / / | | | | | | | | | Change-Id: Ie3108fefbcbb55a4f26273833c9817ce4bd750f1
* | | Prepare 7.1.1-SNAPSHOT buildsMatthias Sohn2024-11-262-60/+60
| | | | | | | | | | | | Change-Id: Ifc710a83cda50f1275cbbd5a828f92d95607f298
* | | JGit v7.1.0.202411261347-rv7.1.0.202411261347-rMatthias Sohn2024-11-262-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I70f154dd1dc8571c5e2057d09d08d4a4d1b7ee37
* | | Add pack-refs command to the CLIYash Chaturvedi2024-11-221-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command can be used to optimize storage of references. For a RefDirectory database, it packs non-symbolic, loose refs into packed-refs. By default, only the references under '$GIT_DIR/refs/tags' are packed. The '--all' option can be used to pack all the references under '$GIT_DIR/refs'. For Reftable, all refs are compacted into a single table. Change-Id: I92e786403f8638d35ae3037844a7ad89e8959e02
* | | Merge "GitTimeParser: Fix multiple errorprone and style comments"Matthias Sohn2024-11-211-1/+1
|\ \ \
| * | | GitTimeParser: Fix multiple errorprone and style commentsIvan Frade2024-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code came from GitDateParser and inherited these issues. It is a good time to fix them: * Use always {} in if and fors (eclipse guide) * Use the more efficient EnumMap for the formatters * variable.equals(CONSTANT) instead of CONSTANT.equals(var) https://errorprone.info/bugpattern/YodaCondition * private constructor to prevent instantiations of a utility classes https://errorprone.info/bugpattern/PrivateConstructorForUtilityClass * methods named in camelCase * Use string.split(..., int) https://errorprone.info/bugpattern/StringSplitter * Initialize variable in first use Change-Id: I0ae70ad9befc66fa9c057af135f2b0b2dab3869a
* | | | Merge branch 'stable-7.0'Matthias Sohn2024-11-217-0/+498
|\ \ \ \ | |/ / / |/| / / | |/ / | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: DiffDriver: fix doc for rust built-in DiffDriver: fix formatting of javadoc Add numberOfObjectsSinceBitmap to RepoStatistics Support built-in diff drivers for hunk header function names Don't fail when trying to prune pack which is already gone Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmap Change-Id: I98beec1186132e749a749706f399237de7d7e45e
| * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-11-218-173/+498
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: DiffDriver: fix doc for rust built-in DiffDriver: fix formatting of javadoc Add numberOfObjectsSinceBitmap to RepoStatistics Support built-in diff drivers for hunk header function names Don't fail when trying to prune pack which is already gone Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmap Change-Id: I7f18e96cc98c56ee7c5e6256fe9e83957e733aa8
| | * 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
| * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-11-111-0/+173
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: Replace custom encoder Constants#encodeASCII by JDK implementation Replace custom encoder `Constants#encode` by JDK implementation Add `numberOfPackFilesAfterBitmap` to RepoStatistics Enhance CommitBuilder#parent to tolerate null parent Change-Id: If05b0d474c728b54cab9af2b7416be30b2754d1b
| | * 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
* | | tests/BasicTest: Use java.time constructors for PersonIdentIvan Frade2024-11-191-27/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop using the deprecated constructor with long/int for time/tz and use instead Instant/ZoneId. The code is still using the old constructor, but this verifies that we are creating identical instances. We will update the code later. Change-Id: I3844bf1e790e53e69a894cd697bddb31b755c2e6
* | | RawParseUtils test: Use java.time to create PersonIdentsIvan Frade2024-11-191-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructor with long/int for time/tz is deprecated in favor of Instant/ZoneId. Update first the expectations in the tests to the new constructors, so we know we are creating the same PersonIdents than before. We update the code later, knowing there is no regression in e.g. format or precision. Change-Id: I05c759bdd4cf73b8afe79fae3c792f2f1300d1e6
* | | Merge "PullCommandTest: assert git status in some simple tests"Matthias Sohn2024-11-191-0/+7
|\ \ \
| * | | PullCommandTest: assert git status in some simple testsMatthias Sohn2024-11-141-0/+7
| | | | | | | | | | | | | | | | | | | | Bug: jgit-107 Change-Id: I54856849df7c6959ccc2b6f10de510950d3da401
* | | | UploadPackTest: fix unclosed resource warningMatthias Sohn2024-11-191-4/+4
| | | | | | | | | | | | | | | | Change-Id: I4efccd72bd567d42e739ee330e26c6b04d5c5c01
* | | | PersonIdent: Use java.time instead of older Date and millisecondsIvan Frade2024-11-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From errorprone: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. Replace the long with milliseconds and int with minutes offset with an Instant and a ZoneOffset. Create new constructors and deprecate variants with Date, milliseconds and minute offsets. When comparing instances of PersonIdent truncate the timestamp precision to 1 second since git commit timestamps are persisted with 1 second precision [1]. [1] https://git-scm.com/docs/git-commit#Documentation/git-commit.txt-Gitinternalformat Change-Id: Id4ba1f108e1ba0bfcdd87ba37c67e2d3cc7d254f
* | | | GitTimeParser: A date parser using the java.time APIIvan Frade2024-11-192-0/+309
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replacement of GitDateParser that uses java.time classes instead of the obsolete Date. Updating GitDateParser would have been a mess of deprecation and methods with confusing names, so I opted for writing a parallel class with the new types. Some differences: * The new DateTimeFormatter is thread-safe, so we don't need the LocalThread cache * No code seems to use other locale than the default, we don't need to cache per locale either Change-Id: If24610a055a47702fb5b7be2fc35a7c722480ee3
* | | Don't fail when trying to prune pack which is already goneJacek Centkowski2024-11-121-78/+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 prunePacked function is called in `TestRepository.packAndPrune` function after repo moves on after the GC was performed. Change-Id: I01b4ddbaddec1fdc24cfbb967e0edfe0de6c4b7c
* | | Merge "DfsBlockCacheConfig: propagate hotmap configs to pack ext cache configs"Ivan Frade2024-11-111-0/+71
|\ \ \
| * | | DfsBlockCacheConfig: propagate hotmap configs to pack ext cache configsLaura Hamelin2024-11-081-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CacheHotMap is currently only set on the base DfsBlockCacheConfig and is not propagated down to PackExt specific caches. Because CacheHotMap is set from a method call rather than from Configs, this change sets per-PackExt CacheHotMap configs on PackExt cache configs both when DfsBlockCacheConfig#setCacheHotMap(...) is called, and when DfsBlockCacheConfig#configure(...) is called after setCacheHotMap. The outer DfsBlockCacheConfig keeps the full CacheHotMap for the same reason that the CacheHotMap config is propagated in both setCacheHotMap and configure: the order of operations setting the configuration from Configs and calling setCacheHotMap is not guaranteed. Change-Id: Id9dc32fedca99ecc83c9dc90c24d9616873a202e
* | | | Merge "Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmap"Matthias Sohn2024-11-111-7/+7
|\ \ \ \
| * | | | Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmapJacek Centkowski2024-11-111-7/+7
| |/ / / | | | | | | | | | | | | | | | | | | | | As sugested in I608011462f1. Change-Id: If66226dd7b08ae768413fa614df5dcb6b44dc118
* / / / DfsGarbageCollector: #setReflogExpire with Instant instead of DateIvan Frade2024-11-081-1/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Date API is full of major design flaws and pitfalls and should be avoided at all costs. Prefer the java.time APIs, specifically, java.time.Instant (for physical time) and java.time.LocalDate[Time] (for civil time). [1] Replace the Date with Instant in the DfsGarbageCollector#setReflogExpire method. [1] https://errorprone.info/bugpattern/JavaUtilDate Change-Id: Ie98e426e63621e8bef96c31bca56aec0c8eef5a6
* | | Merge branch 'stable-7.1'Matthias Sohn2024-11-052-0/+373
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.1: Add missing @since 7.1 to UploadPack#implies ResolveMerger: Allow setting the TreeWalk AttributesNodeProvider Add Union merge strategy support Change-Id: Ib1c1725578e522c88f80f050d221a517bf012017
| * | | Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2024-11-052-0/+373
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: ResolveMerger: Allow setting the TreeWalk AttributesNodeProvider Add Union merge strategy support Change-Id: I15674134f4c73ac2de514d4fac4a36fca7ed7b07
| | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-11-052-0/+373
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: ResolveMerger: Allow setting the TreeWalk AttributesNodeProvider Add Union merge strategy support Change-Id: I0d768d793effd1deabb4807446a4f8c10a82ad74
| | | * 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