aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | | | Add `numberOfPackFilesAfterBitmap` to RepoStatisticsJacek Centkowski2024-10-221-0/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 to `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
* | | | DfsBlockCache: refactor stats implementations.Laura Hamelin2024-10-212-1/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stats interface has an implementation in the interface itself and another inside the PackExtBlockCache class. This asymmetry gets on the way to implement stats-per-table later. Make DfsBlockCacheStats (the stats of a single table) a top-level class and create an aggregator class to combine multiple stats. This makes the stats classes mirror the table classes structure (singles tables + composite). This change is part of a refactor to support providing detailed stats breakdowns for cache implementations using multiple table instances while keeping the existing "aggregated" view of cache stats. Change-Id: I79c11e4ea24afe4b449efdbb47bc81eed363ffd3
* | | | Merge "DfsBlockCacheConfigs: add debug configuration print"Ivan Frade2024-10-151-0/+44
|\ \ \ \
| * | | | DfsBlockCacheConfigs: add debug configuration printLaura Hamelin2024-10-151-0/+44
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will write out configuration values on a line by line basis to a given PrintWriter. Primary usage is as a semi-formatted debug print of the configuration values used by dfs block cache. Change-Id: I96724262245e4aa3423734a8b10de83322c4f89f
* | | | Test advertised capabilities with protocol V0 and allow*Sha1InWantLuca Milanesio2024-10-121-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: I99d062a5a630b02ca3d1fe83bf6cdf3c284ae941
* | | | RevolveMerger: honor ignoreConflicts also for binary filesKamil Musin2024-10-081-0/+70
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently difference in binary files during merge will cause them to be added to unmergedPaths regardless of whether ignoreConflicts is true. This creates an issue during merging with strategy "RECURSIVE", as it makes it impossible to create a virtual commit if there is a difference in a binary file. Resulting in the CONFLICTS_DURING_MERGE_BASE_CALCULATION error being thrown. This is especially problematic, since JGit has a rather simplistic rules for considering file binary, which easily leads to false positives. What we should do instead is keep OURS. This will not lead to silently ignoring difference in the final result. It will allow creation of virtual merge-base commit, and then the difference would be presented again in the final merge results. In essense it only affects what's shown as BASE in 3-way merge. Additionally, this is correct because - It's consistent with treatment of other unmergeable entities, for example Gitlinks - It's consistent with behaviour of CGit: - https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-binary states on diffs in binary OURS is picked by default. - In code: https://git.kernel.org/pub/scm/git/git.git/tree/merge-ll.c#n81 - ignoreConflicts in CGit afterwards ignores all issues with content merging https://git.kernel.org/pub/scm/git/git.git/tree/merge-ort.c#n5201 We also adjust the behaviour when .gitattributes tell us to treat the file as binary for the purpose of the merge. We only change the behaviour when ignoreConlicts = true, as otherwise the current behaviour works as intended. Change-Id: I2b69f80a13d250aad3fe12dd438b2763f3022270
* | | dfs: add configurable name to block cache table statsLaura Hamelin2024-10-073-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The addition of a name will help show statistics broken down per inner cache table when more than one cache table is used. The name configuration is obtained from the config subsection name prefixed by `dfs`, or `dfs` for the base case. Change-Id: Ia16c794f094d756441b779e3b1f1a3c992443509
* | | Merge "DfsBlockCache: use PackExtBlockCacheTable when configured"Ivan Frade2024-10-071-4/+49
|\ \ \
| * | | DfsBlockCache: use PackExtBlockCacheTable when configuredLaura Hamelin2024-10-041-4/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the usage of PackExtBlockCacheTable to the DfsBlockCache, replacing the current DfsBlockCacheTable when PackExtCacheConfigurations exists. When no PackExtCacheConfigurations exists the current DfsBlockCacheTable implementation will be used. Change-Id: I42222a0cb43785baba907a49077dd9874d19d891
* | | | PackWriter: Remove constructor with only Reader as paramIvan Frade2024-09-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At construction time, PackWriter receives the PackConfig as a parameter or reads it from the repository. The only exception is when the constructor receives only a reader (no repo nor conf provided?!). Remove PackWriter(Reader) and let callers be explicit what conf to use. This makes clearer the flow of conf in the PackWriter. Change-Id: If12e122797ffc8c44fc3c435ca1b000ca016645b
* | | | Prepare 7.1.0-SNAPSHOT buildsMatthias Sohn2024-09-032-60/+60
| |/ / |/| | | | | | | | Change-Id: Iba206a2d4645fc275cd2cd1cb3ae965b8ceafb28
* | | Prepare 7.0.1-SNAPSHOT buildsMatthias Sohn2024-09-032-60/+60
| | | | | | | | | | | | Change-Id: I5a6a9e398d8b81bf7bd0afbd6c82116d4472a349
* | | JGit v7.0.0.202409031743-rv7.0.0.202409031743-rMatthias Sohn2024-09-032-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I86507936091e6f7af7588835722672ff2668a205
* | | Revert "Remove deprecatedMatthias Sohn2024-09-031-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LocalDiskRepositoryTestCase#create(boolean,boolean)" This reverts commit 3682611cef41ade46cf5ac194f0674b46367a395. Reason: removing this deprecated method caused a ton of warnings about closing an already closed Repository when running tests. Change-Id: I3e9f224c55c167f92dad39caabfab5e43cf54cfb
* | | Remove deprecated DirCacheCheckout#checkoutEntry methodsMatthias Sohn2024-09-031-4/+7
| | | | | | | | | | | | Change-Id: I28d00d7a70af0fbb76e237dd77b929508720ecdb
* | | Remove deprecated LocalDiskRepositoryTestCase#create(boolean,boolean)Matthias Sohn2024-09-031-8/+5
| | | | | | | | | | | | Change-Id: I9eff2d405b5302753ff2ec1d0eab431bdba69fe0
* | | Merge branch 'master' into stable-7.0Matthias Sohn2024-08-301-0/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: walks: Remove deprecated #createReachabilityChecker() method RepoCommand.RemoteReader: Remove @Deprecated method ReachabilityChecker: Remove @Deprecated method UploadPack: Remove @Deprecated classes and methods ObjectId: Add method to read an ObjectId from a ByteBuffer DfsPackFile: re-add metrics for bitmap index loads Change-Id: I383c9784ced95dfd58f01454fd13b086b180d462
| * | | ObjectId: Add method to read an ObjectId from a ByteBufferIvan Frade2024-08-291-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some storages return data in a convenient ByteBuffer wrapper, but there is no straigh-forward method to read ObjectIds from it. Add ObjectId#fromRaw(ByteBuffer) to read object ids from byte buffers. Change-Id: Ia3b244005e4d9a613294f5ad9dab3b8e7bc3d7df
* | | | ObjectDirectoryTest: ensure WindowCursor is closedMatthias Sohn2024-08-281-9/+10
| | | | | | | | | | | | | | | | Change-Id: I75b7d36181a0d404d4e3dca17b9e436892d97b42
* | | | PackExtBlockCacheTableTest: fix empty block warningMatthias Sohn2024-08-281-0/+2
| | | | | | | | | | | | | | | | Change-Id: I35e7527c6c555cd57fce14889412fa2fd6beab88
* | | | PackExtBlockCacheTableTest: suppress unchecked conversion warningsMatthias Sohn2024-08-281-1/+1
| | | | | | | | | | | | | | | | Change-Id: I5fcad7a824c4a320683d11da52c4e2035231f85d
* | | | PackExtBlockCacheTableTest: suppress boxing warning on test classMatthias Sohn2024-08-281-0/+1
| | | | | | | | | | | | | | | | Change-Id: Ie9d5da0c065ba0118927d530ed589952fb3b2c2b
* | | | DfsBlockCacheConfigTest: suppress boxing warning on test classMatthias Sohn2024-08-281-3/+1
| | | | | | | | | | | | | | | | Change-Id: Ibe7edc5e53c3d467e0e6144a3f8a32989f1ac6af