aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stable-7.0' into stable-7.1Matthias Sohn9 days1-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 Sohn9 days1-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)
* | | 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
| | | * 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 7.1.0-SNAPSHOT buildsMatthias Sohn2024-10-242-2/+2
| | | | | | | | | | | | | | | | Change-Id: Ibaddbad3677636452cad4e8b7ce0a58b1a78f833
| * | | JGit v7.1.0.202410232130-m2v7.1.0.202410232130-m2Matthias Sohn2024-10-232-2/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Ibae7987afb2459fa77c6b151606fbf69fc8a8f49
* | | | Merge "DfsPackCompactor: write object size index"Ivan Frade2024-11-041-0/+44
|\ \ \ \
| * | | | DfsPackCompactor: write object size indexIvan Frade2024-11-011-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the compactor is not writing the object size index for packs. As it is using PackWriter to generate the packs, it needs to explicitely call the writes of each extension. Invoke writeObjectSizeIndex in the compactor. The pack writer will write one if the configuration says so. Change-Id: I8d6bbbb5bd67bfc7dd511aa76463512b1e86a45d
* | | | | [errorprone] Remove deprecated security managerIvan Frade2024-11-012-299/+0
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone warns about this deprecated classes. The recommendation is stop using SecurityManager all together. The Security Manager is deprecated and subject to removal in a future release. There is no replacement for the Security Manager. See JEP 411 [1] for discussion and alternatives. [1] https://openjdk.org/jeps/411 Change-Id: I3c67136e97d13cf24b85e41d94408631c26e8be8
* | | | DfsGarbageCollector: Add setter for reflog expiration time.Saril Sudhakaran2024-10-311-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit reftable writer/compator knows how to prune the history, but the DfsGarbageCollector doesn't expose the time limit. Add a method to DfsGarbageCollector to set the reflog time limit. This value is then passed to the reftable compactor. Callers usually pass here the value from gc.reflogExpire. The reflog block length is stored in 24 bits [1], limiting the size to 16MB. I have observed that in repositories with frequent commits, reflogs hit that size in 6-12 months. [1] https://git-scm.com/docs/reftable Bug: jgit-96 Change-Id: I8b32d6d2b2e1d8af8fb7d9f86225d75f1877eb2f
* | | | dfs: update getBlockCacheStats to return a List of BlockCacheStatsLaura Hamelin2024-10-283-34/+104
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make available all underlying cache table stats for the used cache table implementation. The existing cache table stats implementation only allows a "global" view of the cache table statistics; it does not differentiate between all possible underlying cache tables used. This change allows callers to get the block cache stats broken down per underlying table. These cache stats are intended to be used for monitoring all cache tables independently. Existing usages of getBlockCacheStats now make use of AggregatedBlockCacheStats.fromStatsList to aggregate the list of BlockCacheStats into a single BlockCacheStats instance. Change-Id: I261b3f2849857172397657e5c674b11e09807f27
* | | Merge "PackIndexWriter: create interface to write indexes"Ivan Frade2024-10-222-1/+2
|\ \ \
| * | | PackIndexWriter: create interface to write indexesSam Delmerico2024-10-222-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PackWriter assumes that the primary index goes to a file in a well-known format. This cannot accomodate implementations in other storages or formats (e.g. in a database). Create an interface to write the index (PackIndexWriter). This interface will be implemented by the existing pack index writer classes (PackIndexWriterV1 etc.). As the "PackIndexWriter" name was used by the previous superclass of the file writers, we rename that class to "BasePackIndexWriter". Change-Id: Ia7348395315e458fc7adc75a8db5dcb903e2a4a1