aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
Commit message (Collapse)AuthorAgeFilesLines
* midx: reader for the multipack indexHEADmasterFabio Ponciroli5 hours5-0/+651
| | | | | | | | | | | | Reader and java API to load and query a multipack index. Note: the `multi-pack-index.v1` file used in the tests has been created on a local repository with the "git multi-pack-index" command [1]. [1]: https://git-scm.com/docs/git-multi-pack-index Change-Id: I09def882e1e77e9f22c6236b0a035a1e80bc1ace
* DfsPackFile.PackIndexes: pass primary index to reverse indexIvan Frade24 hours1-4/+8
| | | | | | | | | | | | | DfsPackFile.PackIndexes interface doesn't cache anything and assumes that the caller will keep the loaded references. When the DFS cache implementation needs a primary index to create the reverse index, it invokes its own getIndex method, skipping the reference hold by the caller and potentially triggering reloads. Pass the primary index as parameter in #getReverseIndex(), so the caller can reuse its reference. Change-Id: I1f310eecea73d8f1afc1fb94d40cd94cccdb5996
* Merge "SystemReader: Add support for XDG_CACHE_HOME"Ivan Frade2025-03-213-0/+41
|\
| * SystemReader: Add support for XDG_CACHE_HOMEIvan Frade2025-03-213-0/+41
| | | | | | | | | | | | | | | | | | In following changes we introduce a cache for the Blame CLI and it should follow the XDG standard for the location. Add support for XDG_CACHE_HOME following the XDG_CONFIG_HOME pattern. Change-Id: I622f7eb7ff942fafdb5c5da877d1fb1507d5e482
* | Removed redundant TreeFilter.ANY_DIFF in LogCommand.youtirsin2025-03-201-3/+3
|/ | | | | | Change-Id: I2ecf5f6c220e88dcc3ec2bf132e71156cf0fe622 Signed-off-by: kylezhao <kylezhao@tencent.com> Signed-off-by: youtirsin <brocodzhang@tencent.com>
* BlameResult: Let generator decide when to use the blame cacheIvan Frade2025-03-171-1/+0
| | | | | | | | | | | | BlameResult disables the blame cache in the generator, just in case the generator is setup for a reverse blame (where we cannot use the cache). This prevents the use of the cache by defaut in the Blame cli. The generator already takes care of disabling the cache in reverse blames, so this is unnecessary. Remove the forced disable and let the generator decide when it can use the cache. Change-Id: I451b46c3b88c83025276150253a5396ea59b9f54
* Merge "TreeRevFilter: enable Bloom Filter usage with ChangedPathTreeFilter"Ivan Frade2025-03-146-36/+251
|\
| * TreeRevFilter: enable Bloom Filter usage with ChangedPathTreeFilterXing Huang2025-03-136-36/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paths relevant for a treewalk can be defined with hierarchy of tree filters. TreeRevFilter retrieves these paths from #getPathsBestEffort to apply them to the ChangePathFilter (bloom filters), however the plain list of paths cannot represent the And/Or/Not of the tree filter API (e.g. NOT(/a/b) or AND("/a", "/b")). Introduce a new TreeFilter method #shouldTreeWalk() to let the filters decide whether a set of tree entries need to be tree walked or can be discarded right away. Create a new ChangePathTreeFilter that can use changed path filters to determine shouldTreeWalk. Update TreeRevFilter to use a ChangePathTreeFilter, instead of getting paths and check the changed tree filters itself. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: I8edd0b8423f2bfb85b38d7f997f3cd8dad558bc8
* | ReftableCompactor: Use instant to set the reflog expire timeIvan Frade2025-03-121-18/+41
| | | | | | | | | | | | | | | | | | | | | | The reflog expire time is compared with the time in the PersonIdent. PersonIdent has moved to the java.time API and prefers the getWhenAsInstant() method. Use the Instant method in PersonIdent and propagate the use of Instant to the parameter and setter. Change-Id: I14cfdc93437971737dc7e472ca5c9885e2d37a13
* | GC: Use new java.time API in PersonIdentIvan Frade2025-03-121-6/+9
| | | | | | | | | | | | | | | | | | getWhen() is deprecated in PersonIdent. Move to the new getWhenAsInstant(). Take the change to use Instant for the lastRepackTime. Change-Id: Ib641211e7bbf8ff6947d81910c24b2640fbdb4e7
* | reftable.BlockWriter: Use time API methods from PersonIdentIvan Frade2025-03-121-2/+2
|/ | | | | | | Replace calls to deprecated methods in PersonIdent with their new versions. Change-Id: I8ca92df1de77e3a16d89ef4b97c77a6662555560
* BlameGenerator: Use cache only for candidates modifying the pathIvan Frade2025-03-101-13/+31
| | | | | | | | | | | | | | | | | BlameGenerator is querying the cache on each candidate from the queue. i.e. on every commit in the history that contains the path. The cache call is expensive and, in long histories with poor cache coverage, the blame becomes slower than without cache. Query the cache afer we know the candidate modified the file but before doing the actual blame. In other words, ignore the cache if the commit doesn't modify the file. Compared with previous code, this skips the cache for the commit that creates the file and for the root commit (blame is that commit, so no performance loss). Change-Id: I0fd7279026a30505742527e84f13680b843ad4a3
* FileReftableDatabase: mark autoRefresh volatileMatthias Sohn2025-03-041-7/+6
| | | | | | | using an AtomicReference isn't necessary since we just set or get the field and there is no set based on a get. Change-Id: I83bcfed73ed63ab69af80675f6002e67cadc13e8
* CacheRegion: fix non translatable text warningsMatthias Sohn2025-03-042-2/+7
| | | | Change-Id: I163957653b075f1f05a6219f4d23b340588ffcbd
* Ensure access to autoRefresh is thread-safeMatthias Sohn2025-03-031-6/+7
| | | | Change-Id: I7651613c33803daf00882a543dbf0c3f836110fa
* FileReftableStack: use FileSnapshot to detect modificationMatthias Sohn2025-03-033-3/+69
| | | | | | | | | | | | | | | | | | | | | | | | Reading file attributes is faster than reading file content hence use FileSnapshot to speedup detecting if FileReftableStack is up-to-date. Introduce new option "core.trustTablesListStat" allowing to configure if we can trust file attributes of the "tables.list" file to speedup detection of file modifications. This file is used to store the list of filenames of the files storing Reftables in FileReftableDatabase. If this option is set to "ALWAYS" we trust File attributes and use them to speedup detection of file modifications. If set to "NEVER" the content of the "tables.list" file is always read unconditionally. This can help to avoid caching issues on some filesystems. If set to "AFTER_OPEN" we will open a FileInputStream to refresh File attributes of the "tables.list" file before relying on the refreshed File attributes to detect modifications. This works on some NFS filesystems and is faster than using "NEVER". Change-Id: I3e288d90fb07edf4fa2a03c707a333b26f0c458d
* FileReftableDatabase: consider ref updates by another processMatthias Sohn2025-03-032-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | FileReftableDatabase didn't consider that refs might be changed by another process e.g. using git (which started supporting reftable with version 2.45). Add a test creating a light-weight tag which is updated using git running in another process and assert that FileReftableDatabase recognizes the tag modification. FileReftableStack#addReftable checks if the stack is up-to-date while it holds the FileLock for tables.list, if it is not up-to-date the RefUpdate fails with a LOCK_FAILURE to protect against lost ref updates if another instance of FileReftableDatabase or another thread or process updated the reftable stack since we last read it. If option `reftable.autoRefresh = true` or `setAutoRefresh(true)` was called check before each ref resolution if the reftable stack is up-to-date and, if necessary, reload the reftable stack automatically. Calling `setAutoRefresh(true)` takes precedence over the configured value for option `reftable.autoRefresh`. Add a testConcurrentRacyReload which tests that updates still abort ref updates if the reftable stack the update is based on was outdated. Bug: jgit-102 Change-Id: I1f9faa2afdbfff27e83ff295aef6d572babed4fe
* BlameRegionMerger: report invalid regions with checked exception.Ivan Frade2025-02-271-1/+1
| | | | | | | | | | If the cached regions are invalid the merger throws an IllegalStateException. This is too strict. The caller can just continue working as if there was no cache. Report the error as IOException, that the caller can catch and handle. Change-Id: I19a1061225533b46d3a17936912a11000430f2ce
* Merge branch 'stable-7.1'Matthias Sohn2025-02-264-37/+27
|\ | | | | | | | | | | | | | | | | * stable-7.1: Do not load bitmap indexes during directory scans Fix calculation of pack files and objects since bitmap Pack: no longer set invalid in openFail() Change-Id: I4516cd7f39418ddbb7db381f58aadc99b6d7e40d
| * Merge branch 'stable-7.0' into stable-7.1stable-7.1Matthias Sohn2025-02-264-37/+27
| |\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: Do not load bitmap indexes during directory scans Fix calculation of pack files and objects since bitmap Pack: no longer set invalid in openFail() Change-Id: I480a52909a7f3ee771947c0fd447433e10a9b19b
| | * Merge branch 'stable-6.10' into stable-7.0stable-7.0Matthias Sohn2025-02-264-37/+27
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.10: Do not load bitmap indexes during directory scans Fix calculation of pack files and objects since bitmap Pack: no longer set invalid in openFail() Change-Id: I8846ad4745a360244f81518a028fed5f07086724
| | | * Do not load bitmap indexes during directory scansstable-6.10Martin Fick2025-02-253-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a bitmap index had not been loaded yet, it would get loaded during a directory scan. Loading a bitmap file can be expensive and there is no immediate need to do so during a scan. Fix this by simply setting bitmap index file names on the Packs during directory scans so that bitmaps can be lazily loaded at some later point if they are needed. This change has the side affect of no longer marking a Pack valid if it is currently invalid simply because a bitmap file has been found, as there is no valid reason to do so and this can incorrectly mark a Pack without an index, or with other issues valid. Since the initial lack of a bitmap file, or an invalid one, or the deletion of one, would not result in the Pack being marked invalid, there is no need to overturn the invalid flag when a new bitmap file is found. Change-Id: I056acc09e7ae6a0982acd81b552d524190ebb4be Signed-off-by: Martin Fick <mfick@nvidia.com>
| | | * Merge "Pack: no longer set invalid in openFail()" into stable-6.10Matthias Sohn2025-02-241-14/+16
| | | |\
| | | | * Pack: no longer set invalid in openFail()Martin Fick2025-02-141-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intention of the 'invalidate' argument in openFail() is to invalidate the Pack in certain situations. However, after moving doOpen() to a lock instead of using synchronized, the invalidation approach could also incorrectly mark an already invalid Pack valid, which was never the intention since previously invalid would only ever get set to false if it already was false. Fix this by never setting invalid in openFail(), instead set invalid explicitly before calling openFail when needed. This makes the intent clearer, and aligns better with all the existing comments already trying to explain the boolean (and some of them become obvious enough now that the comment is deleted or shortened). This is also likely faster than adding a conditional in openFail() to make 'invalidate' work properly. Change-Id: Ie6182103ee2994724cb5cb0b64030fedba84b637 Signed-off-by: Martin Fick <mfick@nvidia.com>
| | | * | Fix calculation of pack files and objects since bitmapAntonio Barone2025-02-241-4/+6
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a logic issue where pack files and objects created since the most recent bitmap were incorrectly counted, ignoring their modification time. Since pack files are processed in order from most recent to oldest, we can reliably stop counting as soon as we encounter the first bitmap. By definition, all subsequent pack files are older and should not be included in the count. This ensures accurate repository statistics and prevents overcounting. Bug: jgit-140 Change-Id: I99d85fb70bc7eb42a8d24c74a1fdb8e03334099e
* | | | AddCommand: Use parenthesis to make the operator precedence explicitMatthias Sohn2025-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes errorprone error [OperatorPrecedence], see https://errorprone.info/bugpattern/OperatorPrecedence Change-Id: I3086ac0238bcf4661de6a69b1c133a4f64a3a8d4
* | | | AddCommand: implement --all/--no-allThomas Wolf2025-02-261-7/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Command-line git stages deletions if file paths are given. (i.e., --all is implied.) File paths are also optional if --update or --all (or --no-all) are given. Add a setter and getter for an "all" flag on AddCommand. Check consistency with the "update" flag in call(). Make file paths optional (imply a "." path) if update is set or if setAll() had been called. If file paths are given, set the all flag. Stage deletions if update is set, or if the "all" flag is set. Add the C git command-line options for the "all" flag to jgit.pgm.Add. Bug: jgit-122 Change-Id: Iedddedcaa2d7a2e75162454ea047f34ec1cf3660
* | | | Merge changes I83adebe5,Ibbc9ba97Matthias Sohn2025-02-253-47/+86
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: DirCacheCheckout.preScanOneTree: consider mode bits Merge: improve handling of case-variants
| * | | | DirCacheCheckout.preScanOneTree: consider mode bitsThomas Wolf2025-02-091-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If only the file mode is changed, it's still a change and we must check out the entry from the commit. Bug: jgit-138 Change-Id: I83adebe563fcdb4cbe330edb44884d55ed463c2c
| * | | | Merge: improve handling of case-variantsThomas Wolf2025-02-093-42/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that on a case-insensitive filesystem a merge that includes a rename of a file from one case variant to another does not delete the file. Basically make sure that we don't delete files that we had marked under a case variant as "keep" before, and ensure that when checking out a file, it is written to the file system with the exact casing recorded in the git tree. Bug: egit-76 Change-Id: Ibbc9ba97c70971ba3e83381b41364a5529f5a5dc
* | | | | StringUtils: new #trim methodIvan Frade2025-02-251-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In [1] we could use a "trim" function to remove leading/trailing '/' from paths. [1] https://gerrithub.io/q/I1f2a07327d1a1d8149ee482bc2529b7e1a5303db Change-Id: I490e6afe5c8e6c164d07442b1b388f8a131b4c50
* | | | | DescribeCommand: remove unnecessary else clauseMatthias Sohn2025-02-251-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and reduce indentation. Change-Id: I60a6f721eed051d67aa385a143e2bd3a950485f7
* | | | | DescribeCommand: Add exclusion matches using setExclude()Jonathing2025-02-251-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of right now, the describe command in JGit only supports adding matches for tag inclusion. It does not support adding matches for excluding tags, which is something that can be done with git on the command line using the "--excludes" flag. This change adds a sister method to setMatches(), called setExcludes(), which does exactly that. A few preliminary tests have also been included in DescribeCommandTest. Change-Id: Id1449c7b83c42f1d875eabd5796c748507d69362 Signed-off-by: Jonathing <me@jonathing.me>
* | | | | Insert the Change-Id at the end of the footer blockBen Rohlfs2025-02-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up of change 1208616. The goal is to get even closer to consistency with Gerrit's commit-msg hook. The modified test cases were all verified against what the commit-msg hook would do with the same commit message. The substantial change is that within the footer block we are putting the Change-Id also after lines matching `includeInFooterPattern`, not just after lines matching `footerPattern`. That are lines that start either with a space or with an opening bracket. Change-Id: I39305154e653f8f5adb6b75ca0f6b349b720e9d8
* | | | | Update Change-Id insertion logic to insert after footersBen Rohlfs2025-02-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change we were inserting the Change-Id at the beginning of the footer block, but after any Bug or Issue footers. After this change we are inserting the Change-Id at the end of the footer block, but before any Signed-off-by footers. The overall goal is to stay consistent with Gerrit's commit-msg hook. Change-Id: Id3a73e901ac3c289f79941d12979459c66cb7a13
* | | | | MultiPackIndexPrettyPrinter: add missing @since tagMatthias Sohn2025-02-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and suppress nls warnings. Change-Id: I33be306f4d5894e81fce7b2b34fdff30313417de
* | | | | BlameGenerator: add @since tags to new methods and inner classIvan Frade2025-02-211-5/+11
| | | | | | | | | | | | | | | | | | | | Change-Id: I849d0a3ff07bb53e93112eb716a6537cf2419290
* | | | | BlameGenerator: cache and reuse blame resultsIvan Frade2025-02-203-5/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Blame goes into the history of a file until it blames all lines. If we have a blamed version of the file in cache, we can use it to resolve the lines not blamed yet and cut the calculation earlier. When processing a candidate, check if it is in the cache and if so fill the blame from the pending regions using the information of the cached (and fully blamed) copy. The generator doesn't populate the cache itself. Callers must take the final results and put them in the cache. Change-Id: Ia99b09d6d825e96940ca4200967958923bf647c7
* | | | | Merge "midx.MultiPackIndexPrettyPrinter: pretty printer to debug multi pack ↵Matthias Sohn2025-02-191-0/+154
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | index"
| * | | | | midx.MultiPackIndexPrettyPrinter: pretty printer to debug multi pack indexIvan Frade2025-02-121-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prints the multipack index file in a human readable format. This helps to debug/inspect multipack indexes generated by jgit or git. Change-Id: I04f477b3763b0ecfde6f4379f267de8a609a54e7
* | | | | | blame.cache: Define interface and POJO to cache blame resultsIvan Frade2025-02-182-0/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The blame generator goes into the history of a file until it blames all lines. If the caller keeps a cache of the results, the generator could use it to shorten that walk, using the blame information of an older revision of the file to build the new blame view. Define an interface and POJO for the blame cache. Change-Id: Ib6b033ef46089bbc5a5b32e8e060d4ab0f74b871
* | | | | | Replace usage of deprecated Config#getEnum methodMatthias Sohn2025-02-177-21/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Need to make DirCacheVersions public otherwise Config#allValuesOf cannot invoke its #values method via introspection. Change-Id: Id11a6fdbe7ce3d84f04bf47e98746424dcc761b4
* | | | | | URIish: fix stack overflow in regex matchingThomas Wolf2025-02-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regex for a relative path used greedy matches, which could cause excessive backtracking. Simplify the regex and use a possessive quantifier to avoid backtracking at all: a relative path is a sequence (AB)*A?, where A and B are disjunct: once (AB)* has been matched, there is no need for any backtracking in the relative path. Bug: egit-80 Change-Id: Ic7865f20767d85ec1db2d0b92adcd548099eb643
* | | | | | 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