From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/gix-index/.cargo-checksum.json | 2 +- vendor/gix-index/CHANGELOG.md | 350 +++++++++++++++++++++++++- vendor/gix-index/Cargo.toml | 23 +- vendor/gix-index/src/access/mod.rs | 205 ++++++++++++++- vendor/gix-index/src/decode/mod.rs | 12 +- vendor/gix-index/src/entry/mode.rs | 28 +-- vendor/gix-index/src/entry/stat.rs | 4 +- vendor/gix-index/src/extension/link.rs | 2 + vendor/gix-index/src/extension/tree/verify.rs | 1 + vendor/gix-index/src/file/init.rs | 61 ++++- vendor/gix-index/src/file/verify.rs | 34 +-- vendor/gix-index/src/file/write.rs | 27 +- vendor/gix-index/src/init.rs | 1 + vendor/gix-index/src/verify.rs | 1 + vendor/gix-index/src/write.rs | 18 +- 15 files changed, 689 insertions(+), 80 deletions(-) (limited to 'vendor/gix-index') diff --git a/vendor/gix-index/.cargo-checksum.json b/vendor/gix-index/.cargo-checksum.json index b2a59a45f..40c6b9e9e 100644 --- a/vendor/gix-index/.cargo-checksum.json +++ b/vendor/gix-index/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"879b7a3090276feed6ce703ec8f84263e8187be09c32bd8a5dd9497988167cf8","Cargo.toml":"9b67a290ba62f2e44e9637e82c2bd0e7d102b0b02230aa6e26de9a707f9363bc","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","README.md":"5b2b4dc7ee56738b6049fb41ff03dd3d71fbdc1f0f72080f47c0d24f79c4b5cd","src/access/mod.rs":"e91a8c510376580548f0e11d25056b9d38fa665a3d1a15f54a4da9a763310f52","src/access/sparse.rs":"06b49a6a4578be70814a85e376fda23d0a2465ca83d7a201f9f365b29710a50b","src/decode/entries.rs":"b3e7f09eb9532ae7dbbe51fc1924c94b8a0440b00e4259474c1032509354b480","src/decode/header.rs":"dc8b369949e811e7f6f7234f0b2f344645582079af4fd63f02d7f30c0495ba43","src/decode/mod.rs":"b82933ecad4438bf598ac87651911b8caa5b87d1f2564782f7f5231e51ad980f","src/entry/flags.rs":"b32458d6567bc005c3da72552205788c5191b4fb0de80ebc8fccc86c934e2dc9","src/entry/mod.rs":"eb8f7627124a680ebff0797f888618964a5f80a5c819f56f5f4573b0da74cb4f","src/entry/mode.rs":"e0b7f16d27582f12cdb6a09b1f9a38a38c3857ce267970012f718d97d0441b99","src/entry/stat.rs":"b7e43d95c26d9ead1187c0ef1775cbb61d0ada890c199e7d7c3299acdfc0d087","src/entry/write.rs":"9b1aa309fff759bd5791c39fb348ceb5cc6ce935d7eddaf841b9bea7672aa1c8","src/extension/decode.rs":"b39f3dbde55511e348514a9960f1ec6c724b7f1c222a0d246b6155966ec29624","src/extension/end_of_index_entry/decode.rs":"cfd8f5c3d5657669448826292737460a1dad124f3162ea0323c2e7a7b3bc259a","src/extension/end_of_index_entry/mod.rs":"4f05ce9eecdd91af4ecec5aeb46d3cd90cb96b718b87ce72a5cb7577c5e2a697","src/extension/end_of_index_entry/write.rs":"2a95dc2b10c40b18d2da5bf3cce787b47c09b83efb1cf75a4b70a6258978f897","src/extension/fs_monitor.rs":"ef45ee058ece94470c1c8ac47a84b542f7cfab47bbe49862d0c92310946fcab0","src/extension/index_entry_offset_table.rs":"4f51387b087abbdeb96c87cf935602749bfe36f1d44779c44b24d719d2689de0","src/extension/iter.rs":"d3f3efd6fc542fcc5ec2631083b8ecd764c00838f5614ae4a9f8f6c5436b0009","src/extension/link.rs":"63338550498a040dbf669478bec791033c6bfe4ebc44c3cbfaa3ef10c67421a4","src/extension/mod.rs":"358dcf44248ce3920af9ff3764e972e69ecddd9f12c34faeab1bec85b6c85996","src/extension/resolve_undo.rs":"37d29f82d8fc2926e9ad36796753e7c63c15ab96418577e50f2be78b4c539cf2","src/extension/sparse.rs":"d95d64d39b1007ad1039ab3584671c25b0069e28b2cddfcdc91b090ee4eea684","src/extension/tree/decode.rs":"fda161e6e83f14356fe737ff66bb6cf01f759e584ca271bceff028e4da43a0c7","src/extension/tree/mod.rs":"a7ae7ee2bbacacf3536051f479c4f8c0cab73fa2dd270ab50ec96bdb49fc88db","src/extension/tree/verify.rs":"25a53595b0006f01a022cc045c8cf3504455b7ef646521118b35334e7098a997","src/extension/tree/write.rs":"bb71478fff5773385109c2006ecd7e84808691d566e2be04d8b90c048c9895b6","src/extension/untracked_cache.rs":"14cb9fc4dd097e0faa497a6d27393a9055b0066e63bf9a2350ee02c5f7669f70","src/file/init.rs":"fecb84bd78e7f3197c429192f1d5972137145657849470154781a5bf14570f30","src/file/mod.rs":"6737b994a21d519550d2930dab1d1de2e1cd42f0fc41c2fa10f6c37d24f14045","src/file/verify.rs":"f1bbe16ff8d0360e5899d8fa60583f9a9f058154cc2409b94cf9863ddf9f4a17","src/file/write.rs":"a930bca8a3f82cbe61f0a98eb965f92977a692f504f5680a5b938413aefc49fb","src/init.rs":"97fdc30e5fcbc32ad52467599d5180f6e996696c7647d45ee794f2a56642c64d","src/lib.rs":"61bc554d273e75130905f0db63d01528c0f7671b50fdaf17483b905b857ea5d3","src/verify.rs":"6eab2f992f12e7bc9ff7b836ccc89906c1eae477e4f30bc43f4d5c7b7ba2845d","src/write.rs":"6d4751827d969af19224a559c176e69d9fb3beef9921ce2eb238b7d352b1fdcf"},"package":"616ba958fabfb11263fa042c35690d48a6c7be4e9277e2c7e24ff263b3fe7b82"} \ No newline at end of file +{"files":{"CHANGELOG.md":"a41b5defb7051ee80bcd82a6398ffff375b0a82d3f64f8046379c49d0eefb422","Cargo.toml":"39629ab1d6629c39eec7e97b1b90b956957c5eec22fd4b06c7dce0be4334f743","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","README.md":"5b2b4dc7ee56738b6049fb41ff03dd3d71fbdc1f0f72080f47c0d24f79c4b5cd","src/access/mod.rs":"bc18f80f6e0ac72e08e61779bb596afc8961ab5af89aa3bc63ff70ff45ef2652","src/access/sparse.rs":"06b49a6a4578be70814a85e376fda23d0a2465ca83d7a201f9f365b29710a50b","src/decode/entries.rs":"b3e7f09eb9532ae7dbbe51fc1924c94b8a0440b00e4259474c1032509354b480","src/decode/header.rs":"dc8b369949e811e7f6f7234f0b2f344645582079af4fd63f02d7f30c0495ba43","src/decode/mod.rs":"19e9b9cbe6aa7cc35ede8d9e7d7d2695b78c5880350480005f258740b3d56656","src/entry/flags.rs":"b32458d6567bc005c3da72552205788c5191b4fb0de80ebc8fccc86c934e2dc9","src/entry/mod.rs":"eb8f7627124a680ebff0797f888618964a5f80a5c819f56f5f4573b0da74cb4f","src/entry/mode.rs":"66564a179a5273f8101c1515573ac5e910ebc96f01cc06fee3d344f944d9fc7b","src/entry/stat.rs":"0b08093293be4cea17a9655add779b909e65129709c048a77cc04db610cacf75","src/entry/write.rs":"9b1aa309fff759bd5791c39fb348ceb5cc6ce935d7eddaf841b9bea7672aa1c8","src/extension/decode.rs":"b39f3dbde55511e348514a9960f1ec6c724b7f1c222a0d246b6155966ec29624","src/extension/end_of_index_entry/decode.rs":"cfd8f5c3d5657669448826292737460a1dad124f3162ea0323c2e7a7b3bc259a","src/extension/end_of_index_entry/mod.rs":"4f05ce9eecdd91af4ecec5aeb46d3cd90cb96b718b87ce72a5cb7577c5e2a697","src/extension/end_of_index_entry/write.rs":"2a95dc2b10c40b18d2da5bf3cce787b47c09b83efb1cf75a4b70a6258978f897","src/extension/fs_monitor.rs":"ef45ee058ece94470c1c8ac47a84b542f7cfab47bbe49862d0c92310946fcab0","src/extension/index_entry_offset_table.rs":"4f51387b087abbdeb96c87cf935602749bfe36f1d44779c44b24d719d2689de0","src/extension/iter.rs":"d3f3efd6fc542fcc5ec2631083b8ecd764c00838f5614ae4a9f8f6c5436b0009","src/extension/link.rs":"22bdaf6f25d869481cfa230c8b07d565b928ca8d977e28be7bee6a74131a5a25","src/extension/mod.rs":"358dcf44248ce3920af9ff3764e972e69ecddd9f12c34faeab1bec85b6c85996","src/extension/resolve_undo.rs":"37d29f82d8fc2926e9ad36796753e7c63c15ab96418577e50f2be78b4c539cf2","src/extension/sparse.rs":"d95d64d39b1007ad1039ab3584671c25b0069e28b2cddfcdc91b090ee4eea684","src/extension/tree/decode.rs":"fda161e6e83f14356fe737ff66bb6cf01f759e584ca271bceff028e4da43a0c7","src/extension/tree/mod.rs":"a7ae7ee2bbacacf3536051f479c4f8c0cab73fa2dd270ab50ec96bdb49fc88db","src/extension/tree/verify.rs":"7a39f730d9e79bb3a2f521514e9c635b3c8e3b4c3262f5bffe7e6612c8759bee","src/extension/tree/write.rs":"bb71478fff5773385109c2006ecd7e84808691d566e2be04d8b90c048c9895b6","src/extension/untracked_cache.rs":"14cb9fc4dd097e0faa497a6d27393a9055b0066e63bf9a2350ee02c5f7669f70","src/file/init.rs":"9906c7ba573de75f4823f61cdaceaf7de876f51891a398528dd424d7d3686d6c","src/file/mod.rs":"6737b994a21d519550d2930dab1d1de2e1cd42f0fc41c2fa10f6c37d24f14045","src/file/verify.rs":"57c5619a5a85cd708d3788d5727a7227777ea1b99643c9b95ac881a0442ffa0a","src/file/write.rs":"342c1902b1cf01b3e6ba89d868ba6f2df654f020919a20491ca6c164c709a1cd","src/init.rs":"66d623fe96deea6db9e40091c4caa75f8066c12f7a9283b523b34646d60fbdaa","src/lib.rs":"61bc554d273e75130905f0db63d01528c0f7671b50fdaf17483b905b857ea5d3","src/verify.rs":"207c4b9723fc70b2b9219f39c5992216a4e6cc440247c5a452d2787941c53b3b","src/write.rs":"60fb380ae27962d1f59f117ded6eab56758b04da2e98984635fc7292ed9a929a"},"package":"f54d63a9d13c13088f41f5a3accbec284e492ac8f4f707fcc307c139622e17b7"} \ No newline at end of file diff --git a/vendor/gix-index/CHANGELOG.md b/vendor/gix-index/CHANGELOG.md index b8ca34bc9..bc5a540a8 100644 --- a/vendor/gix-index/CHANGELOG.md +++ b/vendor/gix-index/CHANGELOG.md @@ -5,6 +5,353 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.25.0 (2023-09-24) + +### New Features + + - add trace for `State::from_tree()` as it's rather time-consuming + +### Bug Fixes + + - make time conversion more robust + Previously it could easily fail if very old files are found, or future + ones. Instead, such entries simply can't be compared quickly. + +### Commit Statistics + + + + - 4 commits contributed to the release over the course of 1 calendar day. + - 16 days passed between releases. + - 2 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Prepare changelogs prior to release ([`8a60d5b`](https://github.com/Byron/gitoxide/commit/8a60d5b80877c213c3b646d3061e8a33e0e433ec)) + - Merge branch 'reset' ([`54a8495`](https://github.com/Byron/gitoxide/commit/54a849545140f7f1c0c7564c418071c0a76a34e7)) + - Make time conversion more robust ([`fd034e0`](https://github.com/Byron/gitoxide/commit/fd034e03b5a05dcc7a01014ce6a97b7cf93086be)) + - Add trace for `State::from_tree()` as it's rather time-consuming ([`959dc17`](https://github.com/Byron/gitoxide/commit/959dc175b7925e0a7952c23ad92f83a32ad9609c)) +
+ +## 0.24.0 (2023-09-08) + +### Bug Fixes (BREAKING) + + - use `dyn` trait where possible. + This reduces compile time due to avoiding duplication. + +### Commit Statistics + + + + - 7 commits contributed to the release over the course of 6 calendar days. + - 7 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-date v0.8.0, gix-hash v0.13.0, gix-features v0.34.0, gix-actor v0.26.0, gix-object v0.36.0, gix-path v0.10.0, gix-glob v0.12.0, gix-attributes v0.18.0, gix-packetline-blocking v0.16.6, gix-filter v0.4.0, gix-fs v0.6.0, gix-commitgraph v0.20.0, gix-hashtable v0.4.0, gix-revwalk v0.7.0, gix-traverse v0.32.0, gix-worktree-stream v0.4.0, gix-archive v0.4.0, gix-config-value v0.14.0, gix-tempfile v9.0.0, gix-lock v9.0.0, gix-ref v0.36.0, gix-sec v0.10.0, gix-config v0.29.0, gix-prompt v0.7.0, gix-url v0.23.0, gix-credentials v0.19.0, gix-diff v0.35.0, gix-discover v0.24.0, gix-ignore v0.7.0, gix-index v0.24.0, gix-macros v0.1.0, gix-mailmap v0.18.0, gix-negotiate v0.7.0, gix-pack v0.42.0, gix-odb v0.52.0, gix-pathspec v0.2.0, gix-packetline v0.16.6, gix-transport v0.36.0, gix-protocol v0.39.0, gix-revision v0.21.0, gix-refspec v0.17.0, gix-submodule v0.3.0, gix-worktree v0.25.0, gix-worktree-state v0.2.0, gix v0.53.0, safety bump 39 crates ([`8bd0456`](https://github.com/Byron/gitoxide/commit/8bd045676bb2cdc02624ab93e73ff8518064ca38)) + - Prepare changelogs for release ([`375db06`](https://github.com/Byron/gitoxide/commit/375db06a8442378c3f7a922fae38e2a6694d9d04)) + - Merge branch 'optimizations' ([`6135a5e`](https://github.com/Byron/gitoxide/commit/6135a5ea8709646f01da62939a59dd3a9750e007)) + - Optimize internal `gix` usage for faster compile time ([`9d33e2f`](https://github.com/Byron/gitoxide/commit/9d33e2f5c6a1c370654ef0db90b29c0a023dcf3d)) + - Merge branch `dyn`ification ([`f658fcc`](https://github.com/Byron/gitoxide/commit/f658fcc52dc2200ae34ca53dc10be97fb9012057)) + - Use `dyn` trait where possible. ([`072ee32`](https://github.com/Byron/gitoxide/commit/072ee32f693a31161cd6a843da6582d13efbb20b)) + - Merge branch 'adjustments-for-cargo' ([`b7560a2`](https://github.com/Byron/gitoxide/commit/b7560a2445b62f888bf5aa2ba4c5a47ae037cb23)) +
+ +## 0.23.1 (2023-09-01) + +### Bug Fixes + + - `prefixed_entries_range()` now works correctly with directory prefixes. + Previously, not all directory prefixes would work as expected due to incorrect + search criteria. + +### Commit Statistics + + + + - 2 commits contributed to the release. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-index v0.23.1 ([`11b9c71`](https://github.com/Byron/gitoxide/commit/11b9c71311df978ebb20cca0d765cf249c8eedcf)) + - `prefixed_entries_range()` now works correctly with directory prefixes. ([`6a8314b`](https://github.com/Byron/gitoxide/commit/6a8314bb99099e2a3f5364a5761a5254aa36393a)) +
+ +## 0.23.0 (2023-09-01) + +### New Features + + - add `State::prefixed_range()` to obtain a range of entries matching a prefix. + This makes it easier to make changes to entries of a certain prefix. + - add `State::remove_entries()` and `entry_range()`. + This makes it possible to, among other things, delete all + occurrences of a particular entry. + - add support for `write::Options::skip_hash`. + With it, a hash will not be produced for indices. + +### Bug Fixes + + - `gix-index` prefix matching should now work correctly with conflicting files. + It was done in a rush and lacks a lot of tests. At least now it + has a greater chance of working, as tests that would truly validate + this are still missing for a lack of test date. It can be produced + with `git update-index`, but it wasn't yet worth it. + +### New Features (BREAKING) + + - Check the hash when reading via `File::at()` just like `git`, or skip the check. + Note that indices written with `index.skipHash=true` will be vastly + faster to read by a factor of 2 or more. + +### Bug Fixes (BREAKING) + + - skip the null-hash when validating the index. + This is needed for compatibility with `index.skipHash`, which may skip + producing the hash at the end of the index file, just filling in the + null-hash. + +### Commit Statistics + + + + - 10 commits contributed to the release over the course of 9 calendar days. + - 9 days passed between releases. + - 6 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-date v0.7.4, gix-index v0.23.0, safety bump 5 crates ([`3be2b1c`](https://github.com/Byron/gitoxide/commit/3be2b1ccfe30eeae45711c64b88efc522a2b51b7)) + - Prepare `gix-index` release ([`6fdbc66`](https://github.com/Byron/gitoxide/commit/6fdbc667c20f10734390341b435c15c73b7cd227)) + - Add `State::prefixed_range()` to obtain a range of entries matching a prefix. ([`cfbfa43`](https://github.com/Byron/gitoxide/commit/cfbfa43069c8d82fbd74b8296f63fc050a5ba02a)) + - Add `State::remove_entries()` and `entry_range()`. ([`8b689c2`](https://github.com/Byron/gitoxide/commit/8b689c222668b0c35c508f1907b03cbd4ba09bba)) + - `gix-index` prefix matching should now work correctly with conflicting files. ([`6169325`](https://github.com/Byron/gitoxide/commit/616932516d122a24e29fb42c60147fe43c5cead9)) + - Merge branch 'fixes' ([`4bfd1cc`](https://github.com/Byron/gitoxide/commit/4bfd1cc8f7922a8c4de6b9d078d54b93e78f51ff)) + - Check the hash when reading via `File::at()` just like `git`, or skip the check. ([`61c2e34`](https://github.com/Byron/gitoxide/commit/61c2e34b10c2ad5c92edd4ec1d5d1be2317ac481)) + - Add support for `write::Options::skip_hash`. ([`2f42132`](https://github.com/Byron/gitoxide/commit/2f42132410ef47a7c274030811452ef40701c8a0)) + - Skip the null-hash when validating the index. ([`b310d04`](https://github.com/Byron/gitoxide/commit/b310d044ac5c2bb1c874d0cfe701411e4aef47be)) + - Merge branch 'gix-submodule' ([`363ee77`](https://github.com/Byron/gitoxide/commit/363ee77400805f473c9ad66eadad9214e7ab66f4)) +
+ +## 0.22.0 (2023-08-22) + + + +### Chore + + - split tests off into their own crate to allow feature toggles. + That way we can test with the `parallel` feature and won't have to + create bogus feature toggles that are only used for testing, yet visbible + to users. + +### New Features + + - add `entry::Mode::is_submodule()` + - add `State::prefixed_entries()` returning a range of entries with a given prefix. + This is useful to limit entry traversal and thus do less work. + +### Commit Statistics + + + + - 13 commits contributed to the release over the course of 18 calendar days. + - 30 days passed between releases. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-url v0.22.0, gix-credentials v0.18.0, gix-diff v0.34.0, gix-discover v0.23.0, gix-ignore v0.6.0, gix-bitmap v0.2.7, gix-index v0.22.0, gix-mailmap v0.17.0, gix-negotiate v0.6.0, gix-pack v0.41.0, gix-odb v0.51.0, gix-pathspec v0.1.0, gix-packetline v0.16.5, gix-transport v0.35.0, gix-protocol v0.38.0, gix-revision v0.20.0, gix-refspec v0.16.0, gix-submodule v0.2.0, gix-worktree v0.24.0, gix-worktree-state v0.1.0, gix v0.52.0, gitoxide-core v0.31.0, gitoxide v0.29.0 ([`6c62e74`](https://github.com/Byron/gitoxide/commit/6c62e748240ac0980fc23fdf30f8477dea8b9bc3)) + - Release gix-date v0.7.3, gix-hash v0.12.0, gix-features v0.33.0, gix-actor v0.25.0, gix-object v0.35.0, gix-path v0.9.0, gix-glob v0.11.0, gix-quote v0.4.7, gix-attributes v0.17.0, gix-command v0.2.9, gix-packetline-blocking v0.16.5, gix-filter v0.3.0, gix-fs v0.5.0, gix-commitgraph v0.19.0, gix-hashtable v0.3.0, gix-revwalk v0.6.0, gix-traverse v0.31.0, gix-worktree-stream v0.3.0, gix-archive v0.3.0, gix-config-value v0.13.0, gix-tempfile v8.0.0, gix-lock v8.0.0, gix-ref v0.35.0, gix-sec v0.9.0, gix-config v0.28.0, gix-prompt v0.6.0, gix-url v0.22.0, gix-credentials v0.18.0, gix-diff v0.34.0, gix-discover v0.23.0, gix-ignore v0.6.0, gix-bitmap v0.2.7, gix-index v0.22.0, gix-mailmap v0.17.0, gix-negotiate v0.6.0, gix-pack v0.41.0, gix-odb v0.51.0, gix-pathspec v0.1.0, gix-packetline v0.16.5, gix-transport v0.35.0, gix-protocol v0.38.0, gix-revision v0.20.0, gix-refspec v0.16.0, gix-submodule v0.2.0, gix-worktree v0.24.0, gix-worktree-state v0.1.0, gix v0.52.0, gitoxide-core v0.31.0, gitoxide v0.29.0, safety bump 41 crates ([`30b2761`](https://github.com/Byron/gitoxide/commit/30b27615047692d3ced1b2d9c2ac15a80f79fbee)) + - Update changelogs prior to release ([`f23ea88`](https://github.com/Byron/gitoxide/commit/f23ea8828f2d9ba7559973daca388c9591bcc5fc)) + - Merge branch 'gix-submodule' ([`8f3f358`](https://github.com/Byron/gitoxide/commit/8f3f358800f1fe77d7ba7ebd396a90b692d3c0c1)) + - More cleanup of test crates ([`73c685a`](https://github.com/Byron/gitoxide/commit/73c685a67debcfa26a940f37bbca69cb3a4af57e)) + - Split tests off into their own crate to allow feature toggles. ([`93feea2`](https://github.com/Byron/gitoxide/commit/93feea269eebd114e866e6f29f4a73c0096df9e0)) + - Merge branch 'submodule-in-gix' ([`36f7b78`](https://github.com/Byron/gitoxide/commit/36f7b783c67b8a087076a130f5ee9b90b23bc3cc)) + - Add `entry::Mode::is_submodule()` ([`5fd6364`](https://github.com/Byron/gitoxide/commit/5fd63646a643df0f30e24d0bcdec9edfd3176b50)) + - Merge branch 'pathspec-matching' ([`9f4dfe0`](https://github.com/Byron/gitoxide/commit/9f4dfe0f0b948280692916b596923959ea2fd9da)) + - Add `State::prefixed_entries()` returning a range of entries with a given prefix. ([`05ed965`](https://github.com/Byron/gitoxide/commit/05ed96548da9c1ec04592df24bdd2133df62e16d)) + - Release gix-glob v0.10.2, gix-date v0.7.2, gix-validate v0.8.0, gix-object v0.34.0, gix-ref v0.34.0, gix-config v0.27.0, gix-commitgraph v0.18.2, gix-revwalk v0.5.0, gix-revision v0.19.0, gix-refspec v0.15.0, gix-submodule v0.1.0, safety bump 18 crates ([`4604f83`](https://github.com/Byron/gitoxide/commit/4604f83ef238dc07c85aaeae097399b67f3cfd0c)) + - Merge branch 'dev-on-linux' ([`6b4a303`](https://github.com/Byron/gitoxide/commit/6b4a30330fe49fc97daa73f55bf56580cc0597aa)) + - Fix various tests to run properly on linux ([`ef8ccd9`](https://github.com/Byron/gitoxide/commit/ef8ccd9d16143d37155d063747c69cade80f162d)) +
+ +## 0.21.1 (2023-07-22) + +A maintenance release without user-facing changes. + +### Commit Statistics + + + + - 9 commits contributed to the release over the course of 1 calendar day. + - 3 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-diff v0.33.1, gix-discover v0.22.1, gix-ignore v0.5.1, gix-bitmap v0.2.6, gix-index v0.21.1, gix-mailmap v0.16.1, gix-negotiate v0.5.1, gix-pack v0.40.1, gix-odb v0.50.1, gix-packetline v0.16.4, gix-transport v0.34.1, gix-protocol v0.36.1, gix-revision v0.18.1, gix-refspec v0.14.1, gix-worktree v0.23.0, gix v0.50.0 ([`0062971`](https://github.com/Byron/gitoxide/commit/00629710dffeb10fda340665530353703cf5d129)) + - Release gix-tempfile v7.0.2, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.1, gix-sec v0.8.4, gix-prompt v0.5.4, gix-url v0.21.1, gix-credentials v0.17.1, gix-diff v0.33.1, gix-discover v0.22.1, gix-ignore v0.5.1, gix-bitmap v0.2.6, gix-index v0.21.1, gix-mailmap v0.16.1, gix-negotiate v0.5.1, gix-pack v0.40.1, gix-odb v0.50.1, gix-packetline v0.16.4, gix-transport v0.34.1, gix-protocol v0.36.1, gix-revision v0.18.1, gix-refspec v0.14.1, gix-worktree v0.23.0, gix v0.50.0 ([`107a64e`](https://github.com/Byron/gitoxide/commit/107a64e734580ad9e2c4142db96394529d8072df)) + - Release gix-features v0.32.1, gix-actor v0.24.1, gix-validate v0.7.7, gix-object v0.33.1, gix-path v0.8.4, gix-glob v0.10.1, gix-quote v0.4.6, gix-attributes v0.16.0, gix-command v0.2.8, gix-packetline-blocking v0.16.4, gix-filter v0.2.0, gix-fs v0.4.1, gix-chunk v0.4.4, gix-commitgraph v0.18.1, gix-hashtable v0.2.4, gix-revwalk v0.4.1, gix-traverse v0.30.1, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.5, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.1, gix-sec v0.8.4, gix-prompt v0.5.4, gix-url v0.21.1, gix-credentials v0.17.1, gix-diff v0.33.1, gix-discover v0.22.1, gix-ignore v0.5.1, gix-bitmap v0.2.6, gix-index v0.21.1, gix-mailmap v0.16.1, gix-negotiate v0.5.1, gix-pack v0.40.1, gix-odb v0.50.1, gix-packetline v0.16.4, gix-transport v0.34.1, gix-protocol v0.36.1, gix-revision v0.18.1, gix-refspec v0.14.1, gix-worktree v0.23.0, gix v0.50.0, safety bump 5 crates ([`16295b5`](https://github.com/Byron/gitoxide/commit/16295b58e2581d2e8b8b762816f52baabe871c75)) + - Prepare more changelogs ([`c4cc5f2`](https://github.com/Byron/gitoxide/commit/c4cc5f261d29f712a101033a18293a97a9d4ae85)) + - Release gix-date v0.7.1, gix-hash v0.11.4, gix-trace v0.1.3, gix-features v0.32.0, gix-actor v0.24.0, gix-validate v0.7.7, gix-object v0.33.0, gix-path v0.8.4, gix-glob v0.10.0, gix-quote v0.4.6, gix-attributes v0.15.0, gix-command v0.2.7, gix-packetline-blocking v0.16.3, gix-filter v0.1.0, gix-fs v0.4.0, gix-chunk v0.4.4, gix-commitgraph v0.18.0, gix-hashtable v0.2.4, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.4, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.0, gix-sec v0.8.4, gix-prompt v0.5.3, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-ignore v0.5.0, gix-bitmap v0.2.6, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-packetline v0.16.4, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.1 ([`5cb3589`](https://github.com/Byron/gitoxide/commit/5cb3589b74fc5376e02cbfe151e71344e1c417fe)) + - Update changelogs prior to release ([`2fc66b5`](https://github.com/Byron/gitoxide/commit/2fc66b55097ed494b72d1af939ba5561f71fde97)) + - Merge branch 'gix-archive' ([`1dda48b`](https://github.com/Byron/gitoxide/commit/1dda48ba2fccb93ebac00fe3460e923af43c86ce)) + - Use new `gix-fs` capabilities ([`1c1d19b`](https://github.com/Byron/gitoxide/commit/1c1d19b715b4c3e716ebcde643cad9a75912e5fc)) + - Update license field following SPDX 2.1 license expression standard ([`9064ea3`](https://github.com/Byron/gitoxide/commit/9064ea31fae4dc59a56bdd3a06c0ddc990ee689e)) +
+ +## 0.21.0 (2023-07-19) + +### New Features + + - `State::entry_by_path_ours()` to find an entry which is either stage 0 or stage 2. + This is the preferred way of accessing entries for lookup in the object database as it + will also work while merges are ongoing, returning the correct object accordingly. + +### Commit Statistics + + + + - 7 commits contributed to the release over the course of 11 calendar days. + - 19 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-filter v0.1.0, gix-ignore v0.5.0, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.0 ([`4aca8c2`](https://github.com/Byron/gitoxide/commit/4aca8c2ae2ec588fb65ec4faa0c07c19d219569f)) + - Release gix-features v0.32.0, gix-actor v0.24.0, gix-glob v0.10.0, gix-attributes v0.15.0, gix-commitgraph v0.18.0, gix-config-value v0.12.4, gix-fs v0.4.0, gix-object v0.33.0, gix-ref v0.33.0, gix-config v0.26.0, gix-command v0.2.7, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-filter v0.1.0, gix-ignore v0.5.0, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.0 ([`68ae3ff`](https://github.com/Byron/gitoxide/commit/68ae3ff9d642ec56f088a6a682a073dc16f4e8ca)) + - Adjust package versions (by cargo-smart-release) ([`c70e54f`](https://github.com/Byron/gitoxide/commit/c70e54f163c312c87753a506eeaad462e8579bfb)) + - Prepare changelogs prior to release ([`e4dded0`](https://github.com/Byron/gitoxide/commit/e4dded05138562f9737a7dcfb60570c55769486d)) + - Merge branch 'integrate-filtering' ([`b19a56d`](https://github.com/Byron/gitoxide/commit/b19a56dcfa9bea86332a84aa4e8fad445e7d1724)) + - Assure we run all tests in nextest ([`3821089`](https://github.com/Byron/gitoxide/commit/3821089b6b02c933770705b19fc3126d61beb5a7)) + - `State::entry_by_path_ours()` to find an entry which is either stage 0 or stage 2. ([`20c0d25`](https://github.com/Byron/gitoxide/commit/20c0d2517aad9fc83a3e48a9b0ce6aa9e8b6fded)) +
+ +## 0.20.0 (2023-06-29) + +A maintenance release without user-facing changes. + +### Commit Statistics + + + + - 3 commits contributed to the release over the course of 6 calendar days. + - 6 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-date v0.7.0, gix-trace v0.1.2, gix-actor v0.23.0, gix-commitgraph v0.17.1, gix-utils v0.1.4, gix-object v0.32.0, gix-ref v0.32.0, gix-config v0.25.0, gix-diff v0.32.0, gix-discover v0.21.0, gix-hashtable v0.2.3, gix-revwalk v0.3.0, gix-traverse v0.29.0, gix-index v0.20.0, gix-mailmap v0.15.0, gix-negotiate v0.4.0, gix-pack v0.39.0, gix-odb v0.49.0, gix-protocol v0.35.0, gix-revision v0.17.0, gix-refspec v0.13.0, gix-worktree v0.21.0, gix v0.48.0, safety bump 20 crates ([`27e8c18`](https://github.com/Byron/gitoxide/commit/27e8c18db5a9a21843381c116a8ed6d9f681b3f8)) + - Prepare changelogs prior to release ([`00f96fb`](https://github.com/Byron/gitoxide/commit/00f96fb3110a8f81a1bd0d74c757c15b8773c6f6)) + - Upgrade memmap2 and fastrand dependencies ([`6fc7497`](https://github.com/Byron/gitoxide/commit/6fc74971ac6838cbfd9c869ba3746713001d7a38)) +
+ +## 0.19.0 (2023-06-22) + +### New Features + + - provide basic `tracing` spans for common operations. + This is just the beginning and more crates will integrate with it over time. + +### Commit Statistics + + + + - 7 commits contributed to the release over the course of 5 calendar days. + - 12 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-date v0.6.0, gix-hash v0.11.3, gix-trace v0.1.1, gix-features v0.31.0, gix-actor v0.22.0, gix-path v0.8.2, gix-glob v0.9.0, gix-quote v0.4.5, gix-attributes v0.14.0, gix-chunk v0.4.3, gix-commitgraph v0.17.0, gix-config-value v0.12.2, gix-fs v0.3.0, gix-tempfile v7.0.0, gix-utils v0.1.3, gix-lock v7.0.0, gix-validate v0.7.6, gix-object v0.31.0, gix-ref v0.31.0, gix-sec v0.8.2, gix-config v0.24.0, gix-command v0.2.6, gix-prompt v0.5.2, gix-url v0.20.0, gix-credentials v0.16.0, gix-diff v0.31.0, gix-discover v0.20.0, gix-hashtable v0.2.2, gix-ignore v0.4.0, gix-bitmap v0.2.5, gix-revwalk v0.2.0, gix-traverse v0.28.0, gix-index v0.19.0, gix-mailmap v0.14.0, gix-negotiate v0.3.0, gix-pack v0.38.0, gix-odb v0.48.0, gix-packetline v0.16.3, gix-transport v0.33.0, gix-protocol v0.34.0, gix-revision v0.16.0, gix-refspec v0.12.0, gix-worktree v0.20.0, gix v0.47.0, gitoxide-core v0.29.0, gitoxide v0.27.0, safety bump 30 crates ([`ea9f942`](https://github.com/Byron/gitoxide/commit/ea9f9424e777f10da0e33bb9ffbbefd01c4c5a74)) + - Prepare changelogs prior to release ([`18b0a37`](https://github.com/Byron/gitoxide/commit/18b0a371941aa2d4d62512437d5daa351ba99ffd)) + - Merge branch 'gix-corpus' ([`5861afb`](https://github.com/Byron/gitoxide/commit/5861afb45f32c16eefcd8e7b7480309bf44b6edc)) + - Add more tasks to gather a little more information ([`891a061`](https://github.com/Byron/gitoxide/commit/891a06107883b4a21796facf046a0cd697dc2134)) + - Merge branch 'corpus' ([`aa16c8c`](https://github.com/Byron/gitoxide/commit/aa16c8ce91452a3e3063cf1cf0240b6014c4743f)) + - Change MSRV to 1.65 ([`4f635fc`](https://github.com/Byron/gitoxide/commit/4f635fc4429350bae2582d25de86429969d28f30)) + - Provide basic `tracing` spans for common operations. ([`3cffa26`](https://github.com/Byron/gitoxide/commit/3cffa268460eb2d41bd6a30d45778b88db4ec602)) +
+ +## 0.18.0 (2023-06-10) + +A maintenance release without user-facing changes. + +### Commit Statistics + + + + - 2 commits contributed to the release. + - 3 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + + + +
view details + + * **Uncategorized** + - Release gix-attributes v0.13.1, gix-diff v0.30.1, gix-revwalk v0.1.0, gix-traverse v0.27.0, gix-index v0.18.0, gix-revision v0.15.2, gix-negotiate v0.2.1, gix-pack v0.37.0, gix-odb v0.47.0, gix-protocol v0.33.2, gix-worktree v0.19.0, gix v0.46.0, safety bump 7 crates ([`2560a2c`](https://github.com/Byron/gitoxide/commit/2560a2cc3e1d8c60cd812e15696fa4761d036e19)) + - Prepare changelogs prior to release ([`298f3d7`](https://github.com/Byron/gitoxide/commit/298f3d7359c5b183314d8c584e45dcdd559d88b3)) +
+ ## 0.17.0 (2023-06-06) ### New Features @@ -17,7 +364,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - - 12 commits contributed to the release over the course of 28 calendar days. + - 13 commits contributed to the release over the course of 28 calendar days. - 38 days passed between releases. - 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -29,6 +376,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
view details * **Uncategorized** + - Release gix-date v0.5.1, gix-hash v0.11.2, gix-features v0.30.0, gix-actor v0.21.0, gix-path v0.8.1, gix-glob v0.8.0, gix-quote v0.4.4, gix-attributes v0.13.0, gix-chunk v0.4.2, gix-commitgraph v0.16.0, gix-config-value v0.12.1, gix-fs v0.2.0, gix-tempfile v6.0.0, gix-utils v0.1.2, gix-lock v6.0.0, gix-validate v0.7.5, gix-object v0.30.0, gix-ref v0.30.0, gix-sec v0.8.1, gix-config v0.23.0, gix-command v0.2.5, gix-prompt v0.5.1, gix-url v0.19.0, gix-credentials v0.15.0, gix-diff v0.30.0, gix-discover v0.19.0, gix-hashtable v0.2.1, gix-ignore v0.3.0, gix-bitmap v0.2.4, gix-traverse v0.26.0, gix-index v0.17.0, gix-mailmap v0.13.0, gix-revision v0.15.0, gix-negotiate v0.2.0, gix-pack v0.36.0, gix-odb v0.46.0, gix-packetline v0.16.2, gix-transport v0.32.0, gix-protocol v0.33.0, gix-refspec v0.11.0, gix-worktree v0.18.0, gix v0.45.0, safety bump 29 crates ([`9a9fa96`](https://github.com/Byron/gitoxide/commit/9a9fa96fa8a722bddc5c3b2270b0edf8f6615141)) - Prepare changelogs prior to release ([`8f15cec`](https://github.com/Byron/gitoxide/commit/8f15cec1ec7d5a9d56bb158f155011ef2bb3539b)) - Merge branch 'fix-docs' ([`420553a`](https://github.com/Byron/gitoxide/commit/420553a10d780e0b2dc466cac120989298a5f187)) - Cleaning up documentation ([`2578e57`](https://github.com/Byron/gitoxide/commit/2578e576bfa365d194a23a1fb0bf09be230873de)) diff --git a/vendor/gix-index/Cargo.toml b/vendor/gix-index/Cargo.toml index 6df2678a1..5adb14cf1 100644 --- a/vendor/gix-index/Cargo.toml +++ b/vendor/gix-index/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.64" +rust-version = "1.65" name = "gix-index" -version = "0.17.0" +version = "0.25.0" authors = ["Sebastian Thiel "] include = [ "src/**/*", @@ -24,7 +24,7 @@ include = [ autotests = false description = "A work-in-progress crate of the gitoxide project dedicated implementing the git index file" readme = "README.md" -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/Byron/gitoxide" [package.metadata.docs.rs] @@ -59,32 +59,35 @@ optional = true version = "0.2.15" [dependencies.gix-bitmap] -version = "^0.2.4" +version = "^0.2.7" [dependencies.gix-features] -version = "^0.30.0" +version = "^0.35.0" features = [ "rustsha1", "progress", ] +[dependencies.gix-fs] +version = "^0.7.0" + [dependencies.gix-hash] -version = "^0.11.2" +version = "^0.13.0" [dependencies.gix-lock] -version = "^6.0.0" +version = "^10.0.0" [dependencies.gix-object] -version = "^0.30.0" +version = "^0.37.0" [dependencies.gix-traverse] -version = "^0.26.0" +version = "^0.33.0" [dependencies.itoa] version = "1.0.3" [dependencies.memmap2] -version = "0.5.0" +version = "0.7.0" [dependencies.serde] version = "1.0.114" diff --git a/vendor/gix-index/src/access/mod.rs b/vendor/gix-index/src/access/mod.rs index d07a55bf0..08cb23020 100644 --- a/vendor/gix-index/src/access/mod.rs +++ b/vendor/gix-index/src/access/mod.rs @@ -1,4 +1,5 @@ use std::cmp::Ordering; +use std::ops::Range; use bstr::{BStr, ByteSlice, ByteVec}; use filetime::FileTime; @@ -70,9 +71,67 @@ impl State { /// /// Use the index for accessing multiple stages if they exists, but at least the single matching entry. pub fn entry_index_by_path_and_stage(&self, path: &BStr, stage: entry::Stage) -> Option { - self.entries - .binary_search_by(|e| e.path(self).cmp(path).then_with(|| e.stage().cmp(&stage))) - .ok() + let mut stage_cmp = Ordering::Equal; + let idx = self + .entries + .binary_search_by(|e| { + let res = e.path(self).cmp(path); + if res.is_eq() { + stage_cmp = e.stage().cmp(&stage); + } + res + }) + .ok()?; + self.entry_index_by_idx_and_stage(path, idx, stage, stage_cmp) + } + + /// Walk as far in `direction` as possible, with [`Ordering::Greater`] towards higher stages, and [`Ordering::Less`] + /// towards lower stages, and return the lowest or highest seen stage. + /// Return `None` if there is no greater or smaller stage. + fn walk_entry_stages(&self, path: &BStr, base: usize, direction: Ordering) -> Option { + match direction { + Ordering::Greater => self + .entries + .get(base + 1..)? + .iter() + .enumerate() + .take_while(|(_, e)| e.path(self) == path) + .last() + .map(|(idx, _)| base + 1 + idx), + Ordering::Equal => Some(base), + Ordering::Less => self.entries[..base] + .iter() + .enumerate() + .rev() + .take_while(|(_, e)| e.path(self) == path) + .last() + .map(|(idx, _)| idx), + } + } + + fn entry_index_by_idx_and_stage( + &self, + path: &BStr, + idx: usize, + wanted_stage: entry::Stage, + stage_cmp: Ordering, + ) -> Option { + match stage_cmp { + Ordering::Greater => self.entries[..idx] + .iter() + .enumerate() + .rev() + .take_while(|(_, e)| e.path(self) == path) + .find_map(|(idx, e)| (e.stage() == wanted_stage).then_some(idx)), + Ordering::Equal => Some(idx), + Ordering::Less => self + .entries + .get(idx + 1..)? + .iter() + .enumerate() + .take_while(|(_, e)| e.path(self) == path) + .find_map(|(ofs, e)| (e.stage() == wanted_stage).then_some(idx + ofs + 1)), + } } /// Find the entry index in [`entries()[..upper_bound]`][State::entries()] matching the given repository-relative @@ -101,6 +160,68 @@ impl State { .map(|idx| &self.entries[idx]) } + /// Return the entry at `path` that is either at stage 0, or at stage 2 (ours) in case of a merge conflict. + /// + /// Using this method is more efficient in comparison to doing two searches, one for stage 0 and one for stage 2. + pub fn entry_by_path(&self, path: &BStr) -> Option<&Entry> { + let mut stage_at_index = 0; + let idx = self + .entries + .binary_search_by(|e| { + let res = e.path(self).cmp(path); + if res.is_eq() { + stage_at_index = e.stage(); + } + res + }) + .ok()?; + let idx = if stage_at_index == 0 || stage_at_index == 2 { + idx + } else { + self.entry_index_by_idx_and_stage(path, idx, 2, stage_at_index.cmp(&2))? + }; + Some(&self.entries[idx]) + } + + /// Return the slice of entries which all share the same `prefix`, or `None` if there isn't a single such entry. + /// + /// If `prefix` is empty, all entries are returned. + pub fn prefixed_entries(&self, prefix: &BStr) -> Option<&[Entry]> { + self.prefixed_entries_range(prefix).map(|range| &self.entries[range]) + } + + /// Return the range of entries which all share the same `prefix`, or `None` if there isn't a single such entry. + /// + /// If `prefix` is empty, the range will include all entries. + pub fn prefixed_entries_range(&self, prefix: &BStr) -> Option> { + if prefix.is_empty() { + return Some(0..self.entries.len()); + } + let prefix_len = prefix.len(); + let mut low = self.entries.partition_point(|e| { + e.path(self) + .get(..prefix_len) + .map_or_else(|| e.path(self) <= &prefix[..e.path.len()], |p| p < prefix) + }); + let mut high = low + + self.entries[low..].partition_point(|e| e.path(self).get(..prefix_len).map_or(false, |p| p <= prefix)); + + let low_entry = &self.entries.get(low)?; + if low_entry.stage() != 0 { + low = self + .walk_entry_stages(low_entry.path(self), low, Ordering::Less) + .unwrap_or(low); + } + if let Some(high_entry) = self.entries.get(high) { + if high_entry.stage() != 0 { + high = self + .walk_entry_stages(high_entry.path(self), high, Ordering::Less) + .unwrap_or(high); + } + } + (low != high).then_some(low..high) + } + /// Return the entry at `idx` or _panic_ if the index is out of bounds. /// /// The `idx` is typically returned by [`entry_by_path_and_stage()`][State::entry_by_path_and_stage()]. @@ -114,6 +235,30 @@ impl State { pub fn is_sparse(&self) -> bool { self.is_sparse } + + /// Return the range of entries that exactly match the given `path`, in all available stages, or `None` if no entry with such + /// path exists. + /// + /// The range can be used to access the respective entries via [`entries()`](Self::entries()) or [`entries_mut()](Self::entries_mut()). + pub fn entry_range(&self, path: &BStr) -> Option> { + let mut stage_at_index = 0; + let idx = self + .entries + .binary_search_by(|e| { + let res = e.path(self).cmp(path); + if res.is_eq() { + stage_at_index = e.stage(); + } + res + }) + .ok()?; + + let (start, end) = ( + self.walk_entry_stages(path, idx, Ordering::Less).unwrap_or(idx), + self.walk_entry_stages(path, idx, Ordering::Greater).unwrap_or(idx) + 1, + ); + Some(start..end) + } } /// Mutation @@ -224,6 +369,25 @@ impl State { .then_with(|| compare(a, b)) }); } + + /// Physically remove all entries for which `should_remove(idx, path, entry)` returns `true`, traversing them from first to last. + /// + /// Note that the memory used for the removed entries paths is not freed, as it's append-only. + /// + /// ### Performance + /// + /// To implement this operation typically, one would rather add [entry::Flags::REMOVE] to each entry to remove + /// them when [writing the index](Self::write_to()). + pub fn remove_entries(&mut self, mut should_remove: impl FnMut(usize, &BStr, &mut Entry) -> bool) { + let mut index = 0; + let paths = &self.path_backing; + self.entries.retain_mut(|e| { + let path = e.path_in(paths); + let res = !should_remove(index, path, e); + index += 1; + res + }); + } } /// Extensions @@ -249,3 +413,38 @@ impl State { self.fs_monitor.as_ref() } } + +#[cfg(test)] +mod tests { + use std::path::{Path, PathBuf}; + + #[test] + fn entry_by_path_with_conflicting_file() { + let file = PathBuf::from("tests") + .join("fixtures") + .join(Path::new("loose_index").join("conflicting-file.git-index")); + let file = crate::File::at(file, gix_hash::Kind::Sha1, false, Default::default()).expect("valid file"); + assert_eq!( + file.entries().len(), + 3, + "we have a set of conflict entries for a single file" + ); + for idx in 0..3 { + for wanted_stage in 1..=3 { + let actual_idx = file + .entry_index_by_idx_and_stage( + "file".into(), + idx, + wanted_stage, + (idx + 1).cmp(&(wanted_stage as usize)), + ) + .expect("found"); + assert_eq!( + actual_idx + 1, + wanted_stage as usize, + "the index and stage have a relation, and that is upheld if we search correctly" + ); + } + } + } +} diff --git a/vendor/gix-index/src/decode/mod.rs b/vendor/gix-index/src/decode/mod.rs index f51a5d5e9..12c8c53e4 100644 --- a/vendor/gix-index/src/decode/mod.rs +++ b/vendor/gix-index/src/decode/mod.rs @@ -54,7 +54,7 @@ pub struct Options { impl State { /// Decode an index state from `data` and store `timestamp` in the resulting instance for pass-through, assuming `object_hash` - /// to be used through the file. + /// to be used through the file. Also return the stored hash over all bytes in `data` or `None` if none was written due to `index.skipHash`. pub fn from_bytes( data: &[u8], timestamp: FileTime, @@ -64,7 +64,8 @@ impl State { min_extension_block_in_bytes_for_threading, expected_checksum, }: Options, - ) -> Result<(Self, gix_hash::ObjectId), Error> { + ) -> Result<(Self, Option), Error> { + let _span = gix_features::trace::detail!("gix_index::State::from_bytes()"); let (version, num_entries, post_header_data) = header::decode(data, object_hash)?; let start_of_extensions = extension::end_of_index_entry::decode(data, object_hash); @@ -213,10 +214,11 @@ impl State { } let checksum = gix_hash::ObjectId::from(data); - if let Some(expected_checksum) = expected_checksum { - if checksum != expected_checksum { + let checksum = (!checksum.is_null()).then_some(checksum); + if let Some((expected_checksum, actual_checksum)) = expected_checksum.zip(checksum) { + if actual_checksum != expected_checksum { return Err(Error::ChecksumMismatch { - actual_checksum: checksum, + actual_checksum, expected_checksum, }); } diff --git a/vendor/gix-index/src/entry/mode.rs b/vendor/gix-index/src/entry/mode.rs index 7d3fdf506..0301df438 100644 --- a/vendor/gix-index/src/entry/mode.rs +++ b/vendor/gix-index/src/entry/mode.rs @@ -1,24 +1,16 @@ use crate::entry::Mode; -#[cfg(unix)] -/// Returns whether a a file has the executable permission set. -fn is_executable(metadata: &std::fs::Metadata) -> bool { - use std::os::unix::fs::MetadataExt; - (metadata.mode() & 0o100) != 0 -} - -#[cfg(not(unix))] -/// Returns whether a a file has the executable permission set. -fn is_executable(_metadata: &std::fs::Metadata) -> bool { - false -} - impl Mode { - /// Return true if this is a sparse entry, as it points to a directory which usually isn't what an 'unsparse' index tracks. + /// Return `true` if this is a sparse entry, as it points to a directory which usually isn't what an 'unsparse' index tracks. pub fn is_sparse(&self) -> bool { *self == Self::DIR } + /// Return `true` if this is a submodule entry. + pub fn is_submodule(&self) -> bool { + *self == Self::DIR | Self::SYMLINK + } + /// Compares this mode to the file system version ([`std::fs::symlink_metadata`]) /// and returns the change needed to update this mode to match the file. /// @@ -54,13 +46,15 @@ impl Mode { Mode::SYMLINK if has_symlinks && !stat.is_symlink() => (), Mode::SYMLINK if !has_symlinks && !stat.is_file() => (), Mode::COMMIT | Mode::DIR if !stat.is_dir() => (), - Mode::FILE if executable_bit && is_executable(stat) => return Some(Change::ExecutableBit), - Mode::FILE_EXECUTABLE if executable_bit && !is_executable(stat) => return Some(Change::ExecutableBit), + Mode::FILE if executable_bit && gix_fs::is_executable(stat) => return Some(Change::ExecutableBit), + Mode::FILE_EXECUTABLE if executable_bit && !gix_fs::is_executable(stat) => { + return Some(Change::ExecutableBit) + } _ => return None, }; let new_mode = if stat.is_dir() { Mode::COMMIT - } else if executable_bit && is_executable(stat) { + } else if executable_bit && gix_fs::is_executable(stat) { Mode::FILE_EXECUTABLE } else { Mode::FILE diff --git a/vendor/gix-index/src/entry/stat.rs b/vendor/gix-index/src/entry/stat.rs index 65063dc16..7bde71763 100644 --- a/vendor/gix-index/src/entry/stat.rs +++ b/vendor/gix-index/src/entry/stat.rs @@ -95,8 +95,8 @@ impl Stat { use std::os::unix::fs::MetadataExt; #[cfg(unix)] let res = Stat { - mtime: mtime.try_into()?, - ctime: ctime.try_into()?, + mtime: mtime.try_into().unwrap_or_default(), + ctime: ctime.try_into().unwrap_or_default(), // truncating to 32 bits is fine here because // that's what the linux syscalls returns // just rust upcasts to 64 bits for some reason? diff --git a/vendor/gix-index/src/extension/link.rs b/vendor/gix-index/src/extension/link.rs index 20ce9cb21..5fed2f960 100644 --- a/vendor/gix-index/src/extension/link.rs +++ b/vendor/gix-index/src/extension/link.rs @@ -72,6 +72,7 @@ impl Link { self, split_index: &mut crate::File, object_hash: gix_hash::Kind, + skip_hash: bool, options: crate::decode::Options, ) -> Result<(), crate::file::init::Error> { let shared_index_path = split_index @@ -82,6 +83,7 @@ impl Link { let mut shared_index = crate::File::at( &shared_index_path, object_hash, + skip_hash, crate::decode::Options { expected_checksum: self.shared_index_checksum.into(), ..options diff --git a/vendor/gix-index/src/extension/tree/verify.rs b/vendor/gix-index/src/extension/tree/verify.rs index 6280cecf8..793f31325 100644 --- a/vendor/gix-index/src/extension/tree/verify.rs +++ b/vendor/gix-index/src/extension/tree/verify.rs @@ -111,6 +111,7 @@ impl Tree { } Ok(entries.into()) } + let _span = gix_features::trace::coarse!("gix_index::extension::Tree::verify()"); if !self.name.is_empty() { return Err(Error::RootWithName { diff --git a/vendor/gix-index/src/file/init.rs b/vendor/gix-index/src/file/init.rs index 534f1f08b..99f4be258 100644 --- a/vendor/gix-index/src/file/init.rs +++ b/vendor/gix-index/src/file/init.rs @@ -26,16 +26,18 @@ pub use error::Error; /// Initialization impl File { /// Try to open the index file at `path` with `options`, assuming `object_hash` is used throughout the file, or create a new - /// index that merely exists in memory and is empty. + /// index that merely exists in memory and is empty. `skip_hash` will increase the performance by a factor of 2, at the cost of + /// possibly not detecting corruption. /// /// Note that the `path` will not be written if it doesn't exist. pub fn at_or_default( path: impl Into, object_hash: gix_hash::Kind, + skip_hash: bool, options: decode::Options, ) -> Result { let path = path.into(); - Ok(match Self::at(&path, object_hash, options) { + Ok(match Self::at(&path, object_hash, skip_hash, options) { Ok(f) => f, Err(Error::Io(err)) if err.kind() == std::io::ErrorKind::NotFound => { File::from_state(State::new(object_hash), path) @@ -44,25 +46,60 @@ impl File { }) } - /// Open an index file at `path` with `options`, assuming `object_hash` is used throughout the file. - pub fn at(path: impl Into, object_hash: gix_hash::Kind, options: decode::Options) -> Result { + /// Open an index file at `path` with `options`, assuming `object_hash` is used throughout the file. If `skip_hash` is `true`, + /// we will not get or compare the checksum of the index at all, which generally increases performance of this method by a factor + /// of 2 or more. + /// + /// Note that the verification of the file hash depends on `options`, and even then it's performed after the file was read and not + /// before it is read. That way, invalid files would see a more descriptive error message as we try to parse them. + pub fn at( + path: impl Into, + object_hash: gix_hash::Kind, + skip_hash: bool, + options: decode::Options, + ) -> Result { + let _span = gix_features::trace::detail!("gix_index::File::at()"); let path = path.into(); let (data, mtime) = { + let mut file = std::fs::File::open(&path)?; // SAFETY: we have to take the risk of somebody changing the file underneath. Git never writes into the same file. - let file = std::fs::File::open(&path)?; #[allow(unsafe_code)] let data = unsafe { Mmap::map(&file)? }; + + if !skip_hash { + // Note that even though it's trivial to offload this into a thread, which is worth it for all but the smallest + // index files, we choose more safety here just like git does and don't even try to decode the index if the hashes + // don't match. + // Thanks to `skip_hash`, we can get performance and it's under caller control, at the cost of some safety. + let expected = gix_hash::ObjectId::from(&data[data.len() - object_hash.len_in_bytes()..]); + if !expected.is_null() { + let _span = gix_features::trace::detail!("gix::open_index::hash_index", path = ?path); + let meta = file.metadata()?; + let num_bytes_to_hash = meta.len() - object_hash.len_in_bytes() as u64; + let actual_hash = gix_features::hash::bytes( + &mut file, + num_bytes_to_hash as usize, + object_hash, + &mut gix_features::progress::Discard, + &Default::default(), + )?; + + if actual_hash != expected { + return Err(Error::Decode(decode::Error::ChecksumMismatch { + actual_checksum: actual_hash, + expected_checksum: expected, + })); + } + } + } + (data, filetime::FileTime::from_last_modification_time(&file.metadata()?)) }; let (state, checksum) = State::from_bytes(&data, mtime, object_hash, options)?; - let mut file = File { - state, - path, - checksum: Some(checksum), - }; + let mut file = File { state, path, checksum }; if let Some(mut link) = file.link.take() { - link.dissolve_into(&mut file, object_hash, options)?; + link.dissolve_into(&mut file, object_hash, skip_hash, options)?; } Ok(file) @@ -71,7 +108,7 @@ impl File { /// Consume `state` and pretend it was read from `path`, setting our checksum to `null`. /// /// `File` instances created like that should be written to disk to set the correct checksum via `[File::write()]`. - pub fn from_state(state: crate::State, path: impl Into) -> Self { + pub fn from_state(state: State, path: impl Into) -> Self { File { state, path: path.into(), diff --git a/vendor/gix-index/src/file/verify.rs b/vendor/gix-index/src/file/verify.rs index 6743b37a7..3890acd95 100644 --- a/vendor/gix-index/src/file/verify.rs +++ b/vendor/gix-index/src/file/verify.rs @@ -14,8 +14,6 @@ mod error { actual: gix_hash::ObjectId, expected: gix_hash::ObjectId, }, - #[error("Checksum of in-memory index wasn't computed yet")] - NoChecksum, } } pub use error::Error; @@ -23,19 +21,23 @@ pub use error::Error; impl File { /// Verify the integrity of the index to assure its consistency. pub fn verify_integrity(&self) -> Result<(), Error> { - let checksum = self.checksum.ok_or(Error::NoChecksum)?; - let num_bytes_to_hash = self.path.metadata()?.len() - checksum.as_bytes().len() as u64; - let should_interrupt = AtomicBool::new(false); - let actual = gix_features::hash::bytes_of_file( - &self.path, - num_bytes_to_hash as usize, - checksum.kind(), - &mut gix_features::progress::Discard, - &should_interrupt, - )?; - (actual == checksum).then_some(()).ok_or(Error::ChecksumMismatch { - actual, - expected: checksum, - }) + let _span = gix_features::trace::coarse!("gix_index::File::verify_integrity()"); + if let Some(checksum) = self.checksum { + let num_bytes_to_hash = self.path.metadata()?.len() - checksum.as_bytes().len() as u64; + let should_interrupt = AtomicBool::new(false); + let actual = gix_features::hash::bytes_of_file( + &self.path, + num_bytes_to_hash as usize, + checksum.kind(), + &mut gix_features::progress::Discard, + &should_interrupt, + )?; + (actual == checksum).then_some(()).ok_or(Error::ChecksumMismatch { + actual, + expected: checksum, + }) + } else { + Ok(()) + } } } diff --git a/vendor/gix-index/src/file/write.rs b/vendor/gix-index/src/file/write.rs index 1e8afc07d..47a4cde96 100644 --- a/vendor/gix-index/src/file/write.rs +++ b/vendor/gix-index/src/file/write.rs @@ -22,23 +22,28 @@ impl File { mut out: impl std::io::Write, options: write::Options, ) -> std::io::Result<(Version, gix_hash::ObjectId)> { - let mut hasher = hash::Write::new(&mut out, self.state.object_hash); - let version = self.state.write_to(&mut hasher, options)?; - - let hash = hasher.hash.digest(); - out.write_all(&hash)?; - Ok((version, gix_hash::ObjectId::from(hash))) + let (version, hash) = if options.skip_hash { + let out: &mut dyn std::io::Write = &mut out; + let version = self.state.write_to(out, options)?; + (version, self.state.object_hash.null()) + } else { + let mut hasher = hash::Write::new(&mut out, self.state.object_hash); + let out: &mut dyn std::io::Write = &mut hasher; + let version = self.state.write_to(out, options)?; + (version, gix_hash::ObjectId::from(hasher.hash.digest())) + }; + out.write_all(hash.as_slice())?; + Ok((version, hash)) } /// Write ourselves to the path we were read from after acquiring a lock, using `options`. /// /// Note that the hash produced will be stored which is why we need to be mutable. pub fn write(&mut self, options: write::Options) -> Result<(), Error> { - let mut lock = std::io::BufWriter::new(gix_lock::File::acquire_to_update_resource( - &self.path, - gix_lock::acquire::Fail::Immediately, - None, - )?); + let mut lock = std::io::BufWriter::with_capacity( + 64 * 1024, + gix_lock::File::acquire_to_update_resource(&self.path, gix_lock::acquire::Fail::Immediately, None)?, + ); let (version, digest) = self.write_to(&mut lock, options)?; match lock.into_inner() { Ok(lock) => lock.commit()?, diff --git a/vendor/gix-index/src/init.rs b/vendor/gix-index/src/init.rs index abd71ffdd..9fe0b8e27 100644 --- a/vendor/gix-index/src/init.rs +++ b/vendor/gix-index/src/init.rs @@ -39,6 +39,7 @@ mod from_tree { where Find: for<'a> FnMut(&gix_hash::oid, &'a mut Vec) -> Option>, { + let _span = gix_features::trace::coarse!("gix_index::State::from_tree()"); let mut buf = Vec::new(); let root = find(tree, &mut buf).ok_or(breadthfirst::Error::NotFound { oid: tree.into() })?; diff --git a/vendor/gix-index/src/verify.rs b/vendor/gix-index/src/verify.rs index ba7ec3872..7782cccbc 100644 --- a/vendor/gix-index/src/verify.rs +++ b/vendor/gix-index/src/verify.rs @@ -42,6 +42,7 @@ pub mod extensions { impl State { /// Assure our entries are consistent. pub fn verify_entries(&self) -> Result<(), entries::Error> { + let _span = gix_features::trace::coarse!("gix_index::File::verify_entries()"); let mut previous = None::<&crate::Entry>; for (idx, entry) in self.entries.iter().enumerate() { if let Some(prev) = previous { diff --git a/vendor/gix-index/src/write.rs b/vendor/gix-index/src/write.rs index 43f9b3255..2050ed809 100644 --- a/vendor/gix-index/src/write.rs +++ b/vendor/gix-index/src/write.rs @@ -48,13 +48,27 @@ impl Extensions { /// Note that default options write either index V2 or V3 depending on the content of the entries. #[derive(Debug, Default, Clone, Copy)] pub struct Options { - /// Configures which extensions to write + /// Configures which extensions to write. pub extensions: Extensions, + /// Set the trailing hash of the produced index to all zeroes to save some time. + /// + /// This value is typically controlled by `index.skipHash` and is respected when the index is written + /// via [`File::write()`](crate::File::write()) and [`File::write_to()`](crate::File::write_to()). + /// Note that + pub skip_hash: bool, } impl State { /// Serialize this instance to `out` with [`options`][Options]. - pub fn write_to(&self, out: impl std::io::Write, Options { extensions }: Options) -> std::io::Result { + pub fn write_to( + &self, + out: impl std::io::Write, + Options { + extensions, + skip_hash: _, + }: Options, + ) -> std::io::Result { + let _span = gix_features::trace::detail!("gix_index::State::write()"); let version = self.detect_required_version(); let mut write = CountBytes::new(out); -- cgit v1.2.3