aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | MultiPackIndexWriter: add missing @since for new API classMatthias Sohn2025-02-141-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and fix boxing warnings. Change-Id: Ia9b4deba7892256639c53bac5d7b62f1fbb01389
* | | | | | Merge "DefaultTypedConfigGetter: Box values to avoid infinite recursion"Ivan Frade2025-02-131-13/+27
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | DefaultTypedConfigGetter: Box values to avoid infinite recursionIvan Frade2025-02-121-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone says: DefaultTypedConfigGetter.java:176: error: [InfiniteRecursion] This method always recurses, and will cause a StackOverflowError return getLong(config, section, subsection, name, defaultValue); [1] introduced new getters with boxed types to return a null when the config is not set. The getters of unboxed types should call to the boxed version, but, as the values are not explicitely boxed, they are calling to themselves. [1] https://gerrithub.io/c/eclipse-jgit/jgit/+/1207895 Change-Id: Ied45a199c8ef905e3774a17a04d91a656aa0e42b
* | | | | | midx.MultiPackIndexWriter: a writer for the multipack index formatIvan Frade2025-02-123-0/+479
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fromg git documentation[1]: While the pack-indexes provide fast lookup per packfile, this performance degrades as the number of packfiles increases, because abbreviations need to inspect every packfile and we are more likely to have a miss on our most-recently-used packfile. For some large repositories, repacking into a single packfile is not feasible due to storage space or excessive repack times. (...) The multi-pack-index (MIDX for short) stores a list of objects and their offsets into multiple packfiles. (...) Thus, we can provide O(log N) lookup time for any number of packfiles. This is a writer of the multipack index format. The test only verifies the "shape" of the file, when we get a parser we can check also the values (specially the large offset handling). On the JGit repository, the multipack index generated by this writer passes the validation of `git multi-pack-index verify`. [1] https://git-scm.com/docs/pack-format#_multi_pack_index_midx_files_have_the_following_format Change-Id: I1fca599c4ebf28154f28f039c2c4cfe75b2dc79d
* | | | | Merge "Improve configuration of trusting file attributes in FileSnapshot"Matthias Sohn2025-02-086-61/+260
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Improve configuration of trusting file attributes in FileSnapshotMatthias Sohn2025-02-066-61/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-064-45/+441
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-063-44/+440
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which return null if the option is not configured. Change-Id: I0d444b396458f49712e35ef32427dc45ee3f8ec8
| * | | | CommitConfig: fix potential NPEMatthias Sohn2025-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The local variable `comment` is null if the option core.commentChar is unset. Change-Id: I907dabff395f75b3a6367446389df395b28f027a
* | | | | midx.PackIndexMerger: Helper to iterate over n-indexesIvan Frade2025-02-031-0/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+32
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.2'Matthias Sohn2025-02-012-29/+83
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.2: RevWalk: Add an isMergedIntoAnyCommit() method Prepare 7.2.0-SNAPSHOT builds JGit v7.2.0.202501291320-m2 Pack: separate an open/close accounting lock http.server/BUILD: expose servlet resources as target Change-Id: I285979539d57f3a079ad7902ba82fe5d17de1069
| * | | | Merge branch 'stable-7.1' into stable-7.2Matthias Sohn2025-02-012-29/+83
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-012-29/+83
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-012-29/+83
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | | * Pack: separate an open/close accounting lockMartin Fick2024-12-201-21/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the open/close accounting code used whole Pack object synchronization for locking. Unfortunately, there are other unrelated methods which use whole Pack object synchronization also, mostly to avoid concurrent loading of these independent indices, and they do not touch or need to coordinate with the open/close accounting data. During heavy load when a new file appears after repacking the readFully() threads could uselessly block on threads reading the reverse index. These threads could have been reading from the Pack file instead of waiting for the reverse index to be read. Use a new lock to make this locking more fine grained to prevent the readFully() calling threads from getting blocked in beginWindowCache() while the reverse index or bitmaps are being loaded. Change-Id: I7ac9067ca10cd6d6be0ab25148d99da3ace7ba36 Signed-off-by: Martin Fick <mfick@nvidia.com>
* | | | | PackDirectory: make template variables names more readableLuca Milanesio2025-01-301-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up of I57b24ffb0b3 addressing a readability issue on the variable names of the PackDirectory.handlePackError() method. Change-Id: I877a45328e9b7026e66f300c363ea5c1625af157
* | | | | Merge "Log pruned packfiles as debug and not warn logs"Matthias Sohn2025-01-291-1/+5
|\ \ \ \ \
| * | | | | Log pruned packfiles as debug and not warn logsLuca Milanesio2025-01-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the regular lifecycle of a Git repository, the packfiles are constantly created and removed as part of repacking and pruning. Lower the logging of disappearing packfiles to debug level to reduce the SPAMing on logfile with warnings that should be ignored as part of the normal repository life. Change-Id: I57b24ffb0b32f7a64810cab47b5009f2bf89a6b8
* | | | | | LooseObjects: compute loose object path before retry loopMatthias Sohn2025-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's unnecessary to recompute this for retries. Change-Id: I383ecfa25d795ba177dd5ce14d12b318e38daf9b
* | | | | | LooseObjects: convert while loop into for loopMatthias Sohn2025-01-291-6/+4
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | to simplify the implementation and shorten variable names. Change-Id: I84c038e65263b7d0c38c4e90817ab8b07ad5c2da
* | | | | Submodules: Update submodule with deleted worktreeSimon Eder2025-01-292-17/+81
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | RefDatabase#getReflogReader(String): use #exactRef to resolve refNameMatthias Sohn2025-01-272-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | Don't accept short ref names anymore which is more predictable. Change-Id: I5e7323c610c68b25facd6f2286456716d8e6cf1a
* | | | Deprecate Repository#getReflogReader methodsMatthias Sohn2025-01-275-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | instead use Repository.getRefDatabase().getReflogReader(). Change-Id: I5e66a512c12e11d0ec3275fffde4adb8483430f2
* | | | Add RefDatabase#getReflogReader methodsMatthias Sohn2025-01-276-33/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Set repositoryformatversion=0 when converting refStorage to filesyoutirsin2025-01-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://git-scm.com/docs/repository-version#_version_1 Change-Id: Ic71e55f5dfd4dacedabe54a5881a56b72659f3bc Signed-off-by: youtirsin <youtirsin@qq.com>
* | | | RebaseCommand: use java.time instead of java.util.Date APIMatthias Sohn2024-12-291-8/+13
| | | | | | | | | | | | | | | | Change-Id: I3004d5b586b674e81cc76d0b01cef424d0b1f7f8
* | | | BlockReader: use java.time instead of java.util.Date APIMatthias Sohn2024-12-291-3/+5
| | | | | | | | | | | | | | | | Change-Id: Iea1147f89fb14821b7d052d4e9c3397033dfade4
* | | | SignatureUtils: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+1
| | | | | | | | | | | | | | | | Change-Id: Ibf38c44d6893a1ce3baf83f8f0dbc06d1c8405ad
* | | | WindowCache: fix "empty control-flow statement" warningMatthias Sohn2024-12-291-1/+3
| | | | | | | | | | | | | | | | Change-Id: I61259fc76454b473aee92dc96180219e5f4a4084
* | | | RevCommit: replace deprecated RawParseUtils#headerEndMatthias Sohn2024-12-291-4/+4
| | | | | | | | | | | | | | | | Change-Id: I4e61af621b63b0715596b5a8c7d8eb985d64ce26
* | | | GcLog: replace deprecated GitDateParser with GitTimeParserMatthias Sohn2024-12-291-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | We are moving from java.util.Date to java.time APIs. Change-Id: I6f99d52c2e5bd4734ac1fe5378eed29b398e8c25
* | | | Merge changes If4d68363,I1d1f174f,I107af033Matthias Sohn2024-12-282-8/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: PackWriterBitmapPreparer: Use SystemReader.now() instead of deprecated method TestRepository: Stop using deprecated methods in SystemReader DfsGarbageCollector: Use SystemReader.now() instead of getCurrentTime()
| * | | | PackWriterBitmapPreparer: Use SystemReader.now() instead of deprecated methodIvan Frade2024-12-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SystemReader.getCurrentTime() is deprecated. Change-Id: If4d683633a77eec9b4cc32daed00254fbaa3114b
| * | | | DfsGarbageCollector: Use SystemReader.now() instead of getCurrentTime()Ivan Frade2024-12-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getCurrentTime() is deprecated. Use now() that returns an Instant. Change-Id: I107af03342e6815d97181d6dccd94e2fae2d3b21
* | | | | GarbageCollectCommand, GC: use java.time APIMatthias Sohn2024-12-283-23/+118
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | DescribeCommand: use java.time APIMatthias Sohn2024-12-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: I46b1f12192fe40d3bb740c3ce8632fffcd5fc5de
* | | | SystemReader: add version when annotated methods became deprecatedMatthias Sohn2024-12-251-3/+3
| | | | | | | | | | | | | | | | Change-Id: I2a4e8c18378c1bcbf01c12a79d31cb5a2a050e97
* | | | GitDateFormatter: use java.time APIMatthias Sohn2024-12-251-38/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date API to the java.time API. Change-Id: I904556f94cb28677cce565054bd2cd0f4fb2a096
* | | | Mark static method PersonIdent#getTimeZone as deprecatedMatthias Sohn2024-12-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | since it's using java.util.Timezone. Instead promote usage of #getZoneId which uses ZoneId from the preferred java.time API. Change-Id: I15dee551a81acf0b8aafdbfcfcf200c0d38069f4
* | | | RecursiveMerger: Create PersonIdent with java.time APIIvan Frade2024-12-231-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are moving away from the old java.util.Date api to the java.time.Instant version. This class uses a deprecated constructor in PersonIdent. Use the new constructor for PersonIdent with Instant/ZoneId. Change-Id: I50e2a643ad17a5c0722f87b1bb8abcad286745a5
* | | | RelativeDateFormatter: Use Instant instead of dateIvan Frade2024-12-232-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | ProposedTimestamp: mark unused methods as deprecatedIvan Frade2024-12-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | date() and timestamp() don't seem to have any use. I find only calls to instant(). Mark as deprecated to remove usages of java.util.Date and related classes. Change-Id: I4e77c64678295b5ea83ada253c0e120f7bae5843
* | | | PushCertificateStore: Use Instant, unused var, boxingIvan Frade2024-12-231-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PendingCerts are ordered using PersonIdent#getWhen, which returns the time as java.util.Date. That method is deprecated, as we are moving to the new java.time.Instant API. Sort the pending certs using the Instant time (PersonIdent#getWhenAsInstant). Take the chance to fix two minor warnings: * the inserter is never used in the try{} block * Unnecessary boxing in message format Change-Id: I211e5319dc9865bd5a3468c7f5bbc141a6d5e71e
* | | | SignatureUtils.toString(): allow null signature creation dateThomas Wolf2024-12-201-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some signatures may not have a "created at" timestamp, or the tool used to verify the signature does not report it. If we get none, do not report anything about the signature creation time. This can happen for instance if 'smimesign' is used for verifying x509 signatures. Change-Id: I1a63aa62ffe173e00f27e8aea539b26cd40387c0
* | | | Merge "Merge branch 'stable-7.1'"Matthias Sohn2024-12-191-5/+126
|\ \ \ \
| * | | | Merge branch 'stable-7.1'Matthias Sohn2024-12-201-5/+126
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.1: WindowCache: share removal work among multiple threads Update target platform version in maven build to 4.32 (2024-06) Change-Id: Ic88bb210c5ea080b7553fadec2a1b8d71924365c
| | * | | Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2024-12-201-5/+126
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: WindowCache: share removal work among multiple threads Update target platform version in maven build to 4.32 (2024-06) Change-Id: Idd6a8a2c3b5c6f53645dbe7144afb2e1e24e8ca3
| | | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-12-201-5/+126
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: WindowCache: share removal work among multiple threads Update target platform version in maven build to 4.32 (2024-06) Change-Id: I6ca4988e9ea1e9fc6b3382b40f18f3d9db7b7acb