aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | Merge "Support built-in diff drivers for hunk header function names" into ↵Matthias Sohn2024-11-203-13/+247
| | |\ \ \ | | | |/ / | | |/| | | | | | | stable-6.10
| | | * | Support built-in diff drivers for hunk header function namesKaushik Lingarkar2024-11-203-13/+247
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+4
| | |/ | | | | | | | | | | | | | | | As sugested in I608011462f1. Change-Id: If66226dd7b08ae768413fa614df5dcb6b44dc118
* | | PersonIdent: Preserve the timezone when copying with new timeIvan Frade2024-11-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PersonIdent(PersonIdent,Date) constructor must create a copy with the same author/email/timezone but different time. When we changed the implementation to the new Instant/ZoneId version, we forgot to pass the timezone. This made fail some tests downstream. Pass the timezone when constructing the copy. Change-Id: Iaa979e6dbaa3c55d4c4d2040068ab8b03163cd4e
* | | PersonIdent: Revert @since of #getZoneIdIvan Frade2024-11-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In [1], the @since tag of #getZoneId was updated to 7.1 by mistake. The implementation of the method is different but the API hasn't changed. Revert the tag to 6.1, when the method was introduced. [1] https://gerrithub.io/c/eclipse-jgit/jgit/+/1204142/9/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java Change-Id: If71d763ac28d4ec02bfebb1e65f56227f44e027d
* | | Merge "Change default similarity score to 50(%) to match git's default"Matthias Sohn2024-11-201-1/+1
|\ \ \
| * | | Change default similarity score to 50(%) to match git's defaultMatthias Sohn2024-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git uses a default similarity score of 50(%) for rename detection. Fix RenameDetector to use the same default score. See https://git-scm.com/docs/git-diff#Documentation/git-diff.txt--Mltngt Bug: jgit-110 Change-Id: I4b75910a02bca1afc108ad9e5609fda1e49a29da
* | | | RecursiveMerger: fix boxing warningMatthias Sohn2024-11-191-1/+1
| | | | | | | | | | | | | | | | Change-Id: I6f6ae540b128ff6b965931e829da1368a8b88ddb
* | | | Suppress non-externalized string warningsMatthias Sohn2024-11-194-14/+12
| | | | | | | | | | | | | | | | Change-Id: Ib0737f7ec6b9872f6d4514d140e7d32a4a40809d
* | | | PersonIdent: Use java.time instead of older Date and millisecondsIvan Frade2024-11-191-42/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | SystemReader: add method to get LocalDateTimeIvan Frade2024-11-141-0/+12
|/ / / | | | | | | | | | | | | | | | | | | Using #civilNow() because in the documentation, this calendar-based representation is called "civil time". Change-Id: Iaa363e66683cb548419666068a4ffef44a776e12
* | | SystemReader#now: make it a concrete methodIvan Frade2024-11-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Abstract methods break subclasses (e.g. DelegateSystemReader in gerrit). Updating jgit and gerrit is simpler if we do not add them. I am not sure why some methods are abstract and others dont, but now() can be a concrete method. Make now() concrete. Implement it by default based on getCurrentTime(), so subclasses overriding that method get the same value. Change-Id: I697749f8cba698c5388ed13ebdc2b238d6259358
* | | [errorprone] RawText: Add parenthesis for explicit op precedenceIvan Frade2024-11-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | errorprone reports: [OperatorPrecedence] Use grouping parenthesis to make the operator precedence explicit Take the chance to fix also https://errorprone.info/bugpattern/YodaCondition in the same lines. Change-Id: I6d8f00842ef2bb24cd00fc413121b8a4e20c186b
* | | Merge "SystemReader: Give a default implementation to #getTimezoneAt()"Ivan Frade2024-11-131-6/+3
|\ \ \
| * | | SystemReader: Give a default implementation to #getTimezoneAt()Ivan Frade2024-11-131-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This abstract method forces subclasses (e.g. DelegateSystemReader in gerrit) to update their code, but there is no strong reason to make it abstract (subclasses can override it if needed). Make the method concrete using the current default implementation (which is the same in the mock). Change-Id: Id1df0d71cab1d86879adf48e782f0050d3abcfa9
* | | | RawText: improve performance of isCrLfText and isBinaryXenoAmess2024-11-131-20/+29
|/ / / | | | | | | | | | | | | | | | | | | Inline the function isBinary(byte, byte), and reduce several duplicated checks in it, for better performance. Change-Id: Ida855ed4fd7456d8fb7ed68f3af2dbfa0e25897c
* | | Merge branch 'stable-7.0'Matthias Sohn2024-11-121-3/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: 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: I46f961144f2e3c4c57ef0f63a9c8954fee8133e9
| * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-11-112-20/+26
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * Replace custom encoder Constants#encodeASCII by JDK implementationMatthias Sohn2024-11-091-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | Ensure that the method still throws an IllegalArgumentException for malformed input or if the String contains unmappable characters. Change-Id: I6a340aa1af60c315272ff13b6bf2041ba30c94ca (cherry picked from commit 0fd76114e3436ac635641d06371fd8833179312d)
| | * Replace custom encoder `Constants#encode` by JDK implementationMatthias Sohn2024-11-091-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the implementation provided in the JDK since Java 1.6 by `String#getBytes(Charset)` reduces JGit maintenance effort and improves performance. The method Constants#encode was implemented when JGit still used Java 1.5. See [1]. Kudos to Marcin for proposing to use this improvement in RefWriter [2]. I think it should be used generally. [1] https://repo.or.cz/jgit.git?a=commit;h=bfa3da225f198b19061158499b1135aff07d85b3 [2] https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1195180 Also-By: Marcin Czech <maczech@gmail.com> Change-Id: I361ed6286b98351a315b8a8ffc3cb845831d35b2 (cherry picked from commit e5d2898997462e0f2409c09497ab62c6cda2dbaf)
| | * Add `numberOfPackFilesAfterBitmap` to RepoStatisticsJacek Centkowski2024-11-071-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "DfsBlockCacheConfig: propagate hotmap configs to pack ext cache configs"Ivan Frade2024-11-111-0/+22
|\ \ \
| * | | DfsBlockCacheConfig: propagate hotmap configs to pack ext cache configsLaura Hamelin2024-11-081-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+4
|\ \ \ \
| * | | | Rename numberOfPackFilesAfterBitmap to numberOfPackFilesSinceBitmapJacek Centkowski2024-11-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As sugested in I608011462f1. Change-Id: If66226dd7b08ae768413fa614df5dcb6b44dc118
* | | | | DfsGarbageCollector: #setReflogExpire with Instant instead of DateIvan Frade2024-11-081-5/+6
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* / / / SystemReader: Offer methods with java.time APIIvan Frade2024-11-081-0/+61
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error prone explains: 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). Add to SystemReader methods to get the time and timezone in the new java.time classes (Instant/ZoneId) and mark as deprecated their old counterparts. The mapping of methods is: * #getCurrentTime -> #now (returns Instant instead of int) * #getTimezone -> #getTimeZoneAt (returns ZoneOffset intead of int) * #getTimeZone -> #getTimeZoneId (return ZoneId instead of TimeZone) Change-Id: Ic55b2f442a40046ff0ed24f61f566fc7416471be
* | | Merge branch 'stable-7.1'Matthias Sohn2024-11-055-5/+67
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | | Add missing @since 7.1 to UploadPack#impliesMatthias Sohn2024-11-051-1/+3
| | | | | | | | | | | | | | | | Change-Id: Iabbe1f18a5022b4669a3352493c6fd35920ef25f
| * | | Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2024-11-054-4/+64
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-054-4/+64
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: ResolveMerger: Allow setting the TreeWalk AttributesNodeProvider Add Union merge strategy support Change-Id: I0d768d793effd1deabb4807446a4f8c10a82ad74
| | | * ResolveMerger: Allow setting the TreeWalk AttributesNodeProviderNasser Grainawi2024-11-051-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a merger is created without a Repository, no AttributesNodeProvider is created in the TreeWalk. Since mergers are often created with a custom ObjectInserter and no repo, they skip any lookups of attributes from any of the gitattributes files (within a tree, in the repo info/ dir, or user/global). Since there are potentially merge-affecting attributes in those files, callers might want to use both a custom ObjectInserter and an AttributesNodeProvider. Change-Id: I7997309003bbb598e1002261b3be7f2cc52066c8
| | | * Add Union merge strategy supportNasser Grainawi2024-11-044-4/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * | Merge branch 'stable-6.10' into stable-7.0Matthias Sohn2024-10-231-1/+1
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: Update Apache sshd to 2.14.0 LfsConnectionFactoryTest: remove unnecessary cast JSchSshProtocol2Test: remove unnecessary cast ApacheSshProtocol2Test: remove unnecessary cast NoteMapMerger: remove unnecessary cast Change-Id: I8fca74d88efadc827955b0a5032e6fbd72ce3e0d
| | | * NoteMapMerger: remove unnecessary castMatthias Sohn2024-10-101-1/+1
| | | | | | | | | | | | | | | | Change-Id: I3be4963f506529bbadc5b6dfc0b625ee85effc1f
* | | | Merge "DfsPackCompactor: write object size index"Ivan Frade2024-11-041-0/+17
|\ \ \ \
| * | | | DfsPackCompactor: write object size indexIvan Frade2024-11-011-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] BaseRepositoryBuilder: Use #split(sep, limit)Ivan Frade2024-11-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | String.split(String) and Pattern.split(CharSequence) have surprising behaviour [1]. We use one of the recommended replacements: #split(sep, limit). [1] https://errorprone.info/bugpattern/StringSplitter Change-Id: Ie1cf7590bd8660d21c79c5c3c1bc2765e5d9462b
* | | | | [errorprone] Remove deprecated security managerIvan Frade2024-11-016-61/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | [errorprone] RefDatabase: #getConflictingNames immutable returnIvan Frade2024-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone reports that: This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method. Return always an immutable collection. Change-Id: Id48f3645fd06c8bc72212af180d7d02c7e0b7632
* | | | Merge "DfsGarbageCollector: Add setter for reflog expiration time."Ivan Frade2024-10-311-0/+21
|\ \ \ \
| * | | | DfsGarbageCollector: Add setter for reflog expiration time.Saril Sudhakaran2024-10-311-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | [errorprone] HttpConnection: Add missing summary in javaIvan Frade2024-10-301-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constants don't have summary and errorprone complains about it. Change-Id: Id1470ed9fd54cf7fd684045c5631acc1a8d450c2
* | | | | [errorprone] PackWriter: Fix javadoc tag in new #writeIndex methodIvan Frade2024-10-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduced this method recently and the javadoc is not correct: error: [InvalidInlineTag] This tag is invalid. @code{PackIndexWriter} instance to write the index Change-Id: I34ed3d8b5a121fea9b8163627b46ae4a289c9462
* | | | | [errorprone] ByteArraySet: Add summary fragment to javadocIvan Frade2024-10-301-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by error prone. Change-Id: Icaa69c37d0cde19fc605cb3f3c5f9ed9abfb37d3
* | | | | [errorprone] util.Stats: Add summary fragment to javadocIvan Frade2024-10-301-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errorprone complains about missing summary in these javadocs. [MissingSummary] A summary fragment is required; consider using the value of the @return b lock as a summary fragment instead. * @return variance of the added values ^ (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment) Did you mean '*Returns variance of the added values.'? Change-Id: I29d633ec95c18b17cc92b069dd1a94fbb2a75c94
* | | | | Merge "PackWriter: make PackWriter.writeIndex() take a PackIndexWriter"Ivan Frade2024-10-294-24/+57
|\ \ \ \ \
| * | | | | PackWriter: make PackWriter.writeIndex() take a PackIndexWriterSam Delmerico2024-10-284-24/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the PackWriter implementation required that indexes and their extensions be writable to an OutputStream with a fixed binary format. To support more general index storage formats, allow PackWriter to accept an PackIndexWriter interface which accepts only the objects to store. This allows implementors to choose their storage format. The implementation will be provided by the DfsObjectDatabase. The DfsObjectDatabase is already responsible for providing the OutputStream that was previously used to write indexes. Having it provide a writing interface would be a natural generalization. This idea was previously implemented for PackBitmapIndex writing in https://gerrithub.io/c/eclipse-jgit/jgit/+/1177722. Change-Id: I582d2f3d25d6adb2da243d6d0d7bc405a97d6183
* | | | | | DfsInserter: Read minBytesForObjectSizeIndex only from repo configIvan Frade2024-10-291-21/+7
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In general, JGit reads the configuration it needs from the repository configuration. minBytesForObjectSizeIndex is a special case with a setter for subclasses but that is unnecessary. Remove the setter and read the conf from the repo. Make the property final and read it directly from the conf (it is clearer than parsing a whole PackConfig to read a single value). Change-Id: I8d77247452ff65e6c431fdcfebb90ed2ce40aed1