aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
...
| | | | * RevWalk: Add an isMergedIntoAnyCommit() methodMartin Fick2025-02-012-8/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | Prepare 7.2.0-SNAPSHOT buildsMatthias Sohn2025-01-293-4/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I646edcba7809ab91d8e0a933796b4b5c81736232
| * | | | JGit v7.2.0.202501291320-m2v7.2.0.202501291320-m2Matthias Sohn2025-01-293-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I4e4e203c0f6a2463adefd28d3965eaf44bd2e620
* | | | | 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-277-33/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | * WindowCache: share removal work among multiple threadsMartin Fick2024-12-191-5/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split the removal process into blocks so that it can be shared by multiple threads. This potential work sharing can provide 2 optimizations for removals: 1) It provides an opportunity for separate removal requests to be consolidated into one removal pass. 2) It can reduce removing thread latencies by sharing the removal work with other removing threads which otherwise might not have any work to do due to their removal request being consolidated. This makes the system more efficient and can actually reduce latencies as system load increases due to pack removals! The optimizations above are all achieved without blockng threads to wait for other threads to complete (although naturally there are some synchronization points), and while ensuring that no threads do more work than if they were the only thread available to perform a removal. Change-Id: Ic6809a8abf056299abde0f0c58c77aaf245a8df5 Signed-off-by: Martin Fick <mfick@nvidia.com>
* | | | | CommitTimeRevFilter: add missing @sinceThomas Wolf2024-12-191-4/+10
|/ / / / | | | | | | | | | | | | | | | | | | | | Annotate the new methods using Instant. Change-Id: I1dc4eec59b44e784bcc151bd6a28347f6fd0de03
* | | | transport: Remove usage of CommitTimeRevFilter with long and DatesIvan Frade2024-12-172-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [errorprone] 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). Move callers to the CommitTimeRevFilter java.time.Instant API introduced in the parent commit. Change-Id: Ib92c56ae09f1ad3df7628a8c61212eb84250700d
* | | | CommitTimeRevFilter: Move to java.time APIIvan Frade2024-12-171-17/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 branch 'stable-7.1'Matthias Sohn2024-12-155-55/+65
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-155-53/+60
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-155-53/+60
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | * FileSnapshot: fix warningsMatthias Sohn2024-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - comment empty code block - suppress non-translatable text warning Change-Id: Id49b4a56bbe5454edfe1ea8b79ceeaf51ceac370
| | | * Optionally.Hard: avoid Optional creation on every use,Martin Fick2024-12-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the getOptional() call created an new Optional for its element, and this appears to be somewhat expensive. During a time when a server is heavily loaded because of a poorly maintained repository with potentially 2K+ pack files, calls to Optionally.ofNullable() from within the getOptional() method appeared extensively in the Stacktrace. Reduce the getOptional() call overhead by storing an already created Optional of the element instead of the element itself. This trades the extra space of one extra reference for a potential speed gain in a hotspot. Since the current users of Optionally.Hard reference objects significantly larger than a single reference (and most users are likely to be, else why would they be using an Optionally?), this is likely a good tradeoff. Change-Id: I7adccc915480cbb97a43dcbe074cfb620888c936 Signed-off-by: Martin Fick <mfick@nvidia.com>
| | | * Pack: fix threading bug getting idxMartin Fick2024-12-131-46/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When converting to Optionally, a threading bug was introduced, fix it. The Optionally class itself is not thread safe, and previously it was being called from idx() without any thread synchronization mechanism. This was because previously the variable which held the cached index was volatile. The Optionally<PackIndex> kept the volatile attribute, but that only synchronizes the reference to the Optionally, and not the element inside the Optionally. A clear() from another thread could thus be missed by the idx() call, potentially allowing the idx() call to interact poorly with the Optionally, potentially even causing a memory leak. To fix this, extend the synchronized inside the idx() method to the entire method. Then, additionally remove the now redundant Optional fetch in idx() and the no longer needed volatile. Change-Id: I6077e1aaed96c53200805b4c87a67afb49c2b373 Signed-off-by: Martin Fick <mfick@nvidia.com>
| | | * Fix potential NPE in TreeWalk#getFilterCommandDefinitionNasser Grainawi2024-12-101-0/+3
| | | | | | | | | | | | | | | | Change-Id: Ic6f0fd26153b47b4aeeec105bac431225d9bf8bf
| | | * Advertise "agent" capability when using protocol v2Antonio Barone2024-12-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | * FileSnapshot: silence "Stale file handle" exceptionsMartin Fick2024-12-051-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes a FileSystemException with "Stale file handle" can be thrown while creating a FileSnapshot, likely because the file or directory was deleted. Since NoSuchFileExceptions are already silenced, and the FileSnapshot already handles all IOExceptions, there is likely no value in seeing this info in the logs, treat these situation the same and silence them also. Change-Id: I922f4edf2d332cd704e60276f41a76df242f281c Signed-off-by: Martin Fick <mfick@nvidia.com>