summaryrefslogtreecommitdiffstats
path: root/vendor/gix-index
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix-index
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-index')
-rw-r--r--vendor/gix-index/.cargo-checksum.json2
-rw-r--r--vendor/gix-index/CHANGELOG.md121
-rw-r--r--vendor/gix-index/Cargo.toml24
-rw-r--r--vendor/gix-index/src/access/mod.rs21
-rw-r--r--vendor/gix-index/src/decode/entries.rs6
-rw-r--r--vendor/gix-index/src/decode/mod.rs4
-rw-r--r--vendor/gix-index/src/entry/flags.rs53
-rw-r--r--vendor/gix-index/src/entry/mod.rs63
-rw-r--r--vendor/gix-index/src/entry/mode.rs105
-rw-r--r--vendor/gix-index/src/entry/stat.rs201
-rw-r--r--vendor/gix-index/src/lib.rs7
-rw-r--r--vendor/gix-index/src/write.rs9
12 files changed, 519 insertions, 97 deletions
diff --git a/vendor/gix-index/.cargo-checksum.json b/vendor/gix-index/.cargo-checksum.json
index 33a11976e..0403e11c4 100644
--- a/vendor/gix-index/.cargo-checksum.json
+++ b/vendor/gix-index/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"5fe6c799f8373ce66e99b8b04303cf5b480b668d6a5c90ed48a52acb939ce417","Cargo.toml":"10ecfe6c6adaa8a0541786ad5754d2761760b37934bd74f126faab9acde3b96f","README.md":"5b2b4dc7ee56738b6049fb41ff03dd3d71fbdc1f0f72080f47c0d24f79c4b5cd","src/access/mod.rs":"c3931b8826965815da37b4dc64f185ccc014cdfd5c22edd5e27f9cc764982b2e","src/access/sparse.rs":"06b49a6a4578be70814a85e376fda23d0a2465ca83d7a201f9f365b29710a50b","src/decode/entries.rs":"f4b36701ae17bb98472e9c37c8528a2ab4b3bce1a8eee17264b0f33b88a81caf","src/decode/header.rs":"dc8b369949e811e7f6f7234f0b2f344645582079af4fd63f02d7f30c0495ba43","src/decode/mod.rs":"67bcc963b2e3dc5a7196dad40d4423c7440355e31adc87d49e084162b88a0d62","src/entry/flags.rs":"bd34af362b9632a9f036e031c7fbfb3a204225df47ee6785e9851d5824bf15fe","src/entry/mod.rs":"d1aafb15d6d961ddffbe65b37556912718432f2b46c500dd65a2caa597dd58f8","src/entry/mode.rs":"47bf79906d24b8a2b05d4e8483d3065be40efb4db05f619d43a7915ad4d7a4aa","src/entry/write.rs":"9b1aa309fff759bd5791c39fb348ceb5cc6ce935d7eddaf841b9bea7672aa1c8","src/extension/decode.rs":"b39f3dbde55511e348514a9960f1ec6c724b7f1c222a0d246b6155966ec29624","src/extension/end_of_index_entry/decode.rs":"2b92b42b6379256db179801f5b07e08921a78a30d92000b6b9b3583880ec0004","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":"801f1a5e2423dea9dc77f9f1361dd45cf3217365d30a34eec761554e5f0f5272","src/extension/sparse.rs":"d95d64d39b1007ad1039ab3584671c25b0069e28b2cddfcdc91b090ee4eea684","src/extension/tree/decode.rs":"fda161e6e83f14356fe737ff66bb6cf01f759e584ca271bceff028e4da43a0c7","src/extension/tree/mod.rs":"a7ae7ee2bbacacf3536051f479c4f8c0cab73fa2dd270ab50ec96bdb49fc88db","src/extension/tree/verify.rs":"548f327dd0454d9f2b1475b70f3f3e20563a31523a2529354830d4545481fe55","src/extension/tree/write.rs":"bb71478fff5773385109c2006ecd7e84808691d566e2be04d8b90c048c9895b6","src/extension/untracked_cache.rs":"836401401fb30d6e9e11da7fe78fb890c001aa7d8d67b261a3cc2d7ea31bc302","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":"6789597ac9580f7c0cae3bb614ca1b83f4fb35807d3bfde48b258d7af1d9807f","src/verify.rs":"b5fe5901b46072429376f47675fe807acc7f2490b3720e0e228d23df48818536","src/write.rs":"692741fec3de15efad7b1ef6b4beaccc69d3e136d136de9e1b2a461b4a08f389"},"package":"c12caf7886c7ba06f2b28835cdc2be1dca86bd047d00299d2d49e707ce1c2616"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"24724568d3d258c62d06d75939ba5f7e97a25930837ee54aef7c2901bac03381","Cargo.toml":"85b9932b154dcb337ce91f4e288ac658643252ae8517ec5d4861e12cbcf7c6ed","README.md":"5b2b4dc7ee56738b6049fb41ff03dd3d71fbdc1f0f72080f47c0d24f79c4b5cd","src/access/mod.rs":"471dc5535c9e56c0158081c7f0c2c605c8cc01760eaca9140bb25f0f134d44e6","src/access/sparse.rs":"06b49a6a4578be70814a85e376fda23d0a2465ca83d7a201f9f365b29710a50b","src/decode/entries.rs":"b3e7f09eb9532ae7dbbe51fc1924c94b8a0440b00e4259474c1032509354b480","src/decode/header.rs":"dc8b369949e811e7f6f7234f0b2f344645582079af4fd63f02d7f30c0495ba43","src/decode/mod.rs":"74b5c41e312dfe7e7c9844646db0d935641c5b4bb681b5093c30694dd68888f0","src/entry/flags.rs":"b32458d6567bc005c3da72552205788c5191b4fb0de80ebc8fccc86c934e2dc9","src/entry/mod.rs":"eb8f7627124a680ebff0797f888618964a5f80a5c819f56f5f4573b0da74cb4f","src/entry/mode.rs":"e0b7f16d27582f12cdb6a09b1f9a38a38c3857ce267970012f718d97d0441b99","src/entry/stat.rs":"bcbdf5b3602b613ff9d8bf571d397375911ae77d6fe044f356cfc6f08004febc","src/entry/write.rs":"9b1aa309fff759bd5791c39fb348ceb5cc6ce935d7eddaf841b9bea7672aa1c8","src/extension/decode.rs":"b39f3dbde55511e348514a9960f1ec6c724b7f1c222a0d246b6155966ec29624","src/extension/end_of_index_entry/decode.rs":"2b92b42b6379256db179801f5b07e08921a78a30d92000b6b9b3583880ec0004","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":"801f1a5e2423dea9dc77f9f1361dd45cf3217365d30a34eec761554e5f0f5272","src/extension/sparse.rs":"d95d64d39b1007ad1039ab3584671c25b0069e28b2cddfcdc91b090ee4eea684","src/extension/tree/decode.rs":"fda161e6e83f14356fe737ff66bb6cf01f759e584ca271bceff028e4da43a0c7","src/extension/tree/mod.rs":"a7ae7ee2bbacacf3536051f479c4f8c0cab73fa2dd270ab50ec96bdb49fc88db","src/extension/tree/verify.rs":"548f327dd0454d9f2b1475b70f3f3e20563a31523a2529354830d4545481fe55","src/extension/tree/write.rs":"bb71478fff5773385109c2006ecd7e84808691d566e2be04d8b90c048c9895b6","src/extension/untracked_cache.rs":"836401401fb30d6e9e11da7fe78fb890c001aa7d8d67b261a3cc2d7ea31bc302","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":"b5fe5901b46072429376f47675fe807acc7f2490b3720e0e228d23df48818536","src/write.rs":"6d4751827d969af19224a559c176e69d9fb3beef9921ce2eb238b7d352b1fdcf"},"package":"fa282756760f79c401d4f4f42588fbb4aa27bbb4b0830f3b4d3480c21a4ac5a7"} \ No newline at end of file
diff --git a/vendor/gix-index/CHANGELOG.md b/vendor/gix-index/CHANGELOG.md
index 855256c81..abd7fe9f5 100644
--- a/vendor/gix-index/CHANGELOG.md
+++ b/vendor/gix-index/CHANGELOG.md
@@ -5,6 +5,124 @@ 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.16.0 (2023-04-26)
+
+### New Features
+
+ - <csr-id-9af47c3971fdb744dbc38c1920430975e4a9ba84/> add `Index::entries_mut_and_pathbacking()`.
+ With it one can read entries and read paths at the same time.
+
+### New Features (BREAKING)
+
+ - <csr-id-b83ee366a3c65c717beb587ad809268f1c54b8ad/> Rename `serde1` cargo feature to `serde` and use the weak-deps cargo capability.
+ With it it's possible to not automatically declare all optional dependencies externally visible
+ features, and thus re-use feature names that oterwise are also a crate name.
+
+ Previously I thought that `serde1` is for future-proofing and supporting multiple serde versions
+ at the same time. However, it's most definitely a burden I wouldn't want anyway, so using
+ `serde` seems to be the way to go into the future.
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 25 commits contributed to the release over the course of 23 calendar days.
+ - 27 days passed between releases.
+ - 2 commits were understood as [conventional](https://www.conventionalcommits.org).
+ - 1 unique issue was worked on: [#814](https://github.com/Byron/gitoxide/issues/814)
+
+### Thanks Clippy
+
+<csr-read-only-do-not-edit/>
+
+[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
+
+### Commit Details
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **[#814](https://github.com/Byron/gitoxide/issues/814)**
+ - Rename `serde1` cargo feature to `serde` and use the weak-deps cargo capability. ([`b83ee36`](https://github.com/Byron/gitoxide/commit/b83ee366a3c65c717beb587ad809268f1c54b8ad))
+ * **Uncategorized**
+ - Release gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0 ([`e4df557`](https://github.com/Byron/gitoxide/commit/e4df5574c0813a0236319fa6e8b3b41bab179fc8))
+ - Release gix-hash v0.11.1, gix-path v0.7.4, gix-glob v0.6.0, gix-attributes v0.11.0, gix-config-value v0.11.0, gix-fs v0.1.1, gix-tempfile v5.0.3, gix-utils v0.1.1, gix-lock v5.0.1, gix-object v0.29.1, gix-ref v0.28.0, gix-sec v0.7.0, gix-config v0.21.0, gix-prompt v0.4.0, gix-url v0.17.0, gix-credentials v0.13.0, gix-diff v0.29.0, gix-discover v0.17.0, gix-hashtable v0.2.0, gix-ignore v0.1.0, gix-bitmap v0.2.3, gix-traverse v0.25.0, gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0, safety bump 7 crates ([`91134a1`](https://github.com/Byron/gitoxide/commit/91134a11c8ba0e942f692488ec9bce9fa1086324))
+ - Prepare changelogs prior to release ([`30a1a71`](https://github.com/Byron/gitoxide/commit/30a1a71f36f24faac0e0b362ffdfedea7f9cdbf1))
+ - Merge branch 'fix-823' ([`6ebd61e`](https://github.com/Byron/gitoxide/commit/6ebd61e548a36a04e413ac725a03e607a3588334))
+ - Thanks clippy ([`14e64e7`](https://github.com/Byron/gitoxide/commit/14e64e74649cfb1f2f99da87015939af98fae5c8))
+ - Release gix-utils v0.1.0, gix-hash v0.11.0, gix-date v0.5.0, gix-features v0.29.0, gix-actor v0.20.0, gix-object v0.29.0, gix-archive v0.1.0, gix-fs v0.1.0, safety bump 25 crates ([`8dbd0a6`](https://github.com/Byron/gitoxide/commit/8dbd0a60557a85acfa231800a058cbac0271a8cf))
+ - Make fmt ([`5d2b5d0`](https://github.com/Byron/gitoxide/commit/5d2b5d02c3869e07dc2507a8f2519ee1df633df7))
+ - Merge branch 'main' into dev ([`cdef398`](https://github.com/Byron/gitoxide/commit/cdef398c4a3bd01baf0be2c27a3f77a400172b0d))
+ - Rename the serde1 feature to serde ([`19338d9`](https://github.com/Byron/gitoxide/commit/19338d934b6712b7d6bd3fa3b2e4189bf7e6c8a1))
+ - Add a test for --intend-to-add and clarify what this flag means. ([`27471e7`](https://github.com/Byron/gitoxide/commit/27471e7f421446cc8f6d4543bdf85fe4e753b944))
+ - Add `Index::entries_mut_and_pathbacking()`. ([`9af47c3`](https://github.com/Byron/gitoxide/commit/9af47c3971fdb744dbc38c1920430975e4a9ba84))
+ - Refactor ([`691758a`](https://github.com/Byron/gitoxide/commit/691758a4491f8430b61e418dad33d8d901f89361))
+ - Improve documentation of gix_index::entry::Stat::matches ([`1e19760`](https://github.com/Byron/gitoxide/commit/1e19760ad32722e89a928a3d2f9cb91e48e63973))
+ - Clarify Stat::is_racy documentation ([`4736b60`](https://github.com/Byron/gitoxide/commit/4736b6061acd28abfe8872a10f803f42e0591e35))
+ - Improve Mode::change_to_match_fs documentation ([`bf8a7a4`](https://github.com/Byron/gitoxide/commit/bf8a7a493645254365bc69f85b0aa0e0ea884a3e))
+ - Cleanup entry::mode API ([`9cb76e9`](https://github.com/Byron/gitoxide/commit/9cb76e9f46e40d64e154f44ca08d52443cd81300))
+ - Update index::entry::stat tests ([`f2a9b3f`](https://github.com/Byron/gitoxide/commit/f2a9b3fb87013ce55cb519d047340035d1e20530))
+ - Parallel status check ([`d7f250d`](https://github.com/Byron/gitoxide/commit/d7f250ddbd53a994a17db41f86cc780b45e9ee5a))
+ - Streamline status API ([`0f747f3`](https://github.com/Byron/gitoxide/commit/0f747f303089fd862c24d4ad93b75d3064c9328b))
+ - Centralize index entry Stat creation/comparison ([`870bdb2`](https://github.com/Byron/gitoxide/commit/870bdb2f3957e0f5690679e2aeb6752cd0b8d93e))
+ - Allow access to index timestamp ([`c49f12d`](https://github.com/Byron/gitoxide/commit/c49f12d8940a3b0d8b4ca1fcb3c40119cd8167dc))
+ - Release gix-hash v0.10.4, gix-hashtable v0.1.3 ([`b574a39`](https://github.com/Byron/gitoxide/commit/b574a3904203762a6b9e475e16a7c358d7616599))
+ - Merge branch 'patch-1' ([`d0052c1`](https://github.com/Byron/gitoxide/commit/d0052c13cabcde8058177d2439053b50ea5adbfc))
+ - Update to latest `bitflags` version. ([`594cca5`](https://github.com/Byron/gitoxide/commit/594cca51840c00654af05acc7f7c7d01fe699067))
+</details>
+
+## 0.15.1 (2023-03-30)
+
+### Documentation
+
+ - <csr-id-02c4659984fa6423bc76cc4980a143edaba8ace0/> fix minor typos
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 3 commits contributed to the release over the course of 19 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
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **Uncategorized**
+ - Release gix-path v0.7.3, gix-config-value v0.10.2, gix-config v0.20.1, gix-discover v0.16.2, gix-index v0.15.1, gix-odb v0.43.1, gix-packetline v0.15.1, gix-protocol v0.30.2, gix-worktree v0.15.2, gix v0.43.1 ([`38eed1d`](https://github.com/Byron/gitoxide/commit/38eed1d06e7cbb8fbcd54b2cad3163ca45e0baf1))
+ - Fix minor typos ([`02c4659`](https://github.com/Byron/gitoxide/commit/02c4659984fa6423bc76cc4980a143edaba8ace0))
+ - Merge branch 'fix-cred-helper' ([`01277a6`](https://github.com/Byron/gitoxide/commit/01277a681e4997896e04567490c572b5af606f35))
+</details>
+
+## 0.15.0 (2023-03-10)
+
+A maintenance release without user-facing changes.
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 2 commits contributed to the release.
+ - 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
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **Uncategorized**
+ - Release gix-tempfile v5.0.0, gix-lock v5.0.0, gix-ref v0.27.0, gix-config v0.19.0, gix-url v0.16.0, gix-credentials v0.12.0, gix-discover v0.16.0, gix-index v0.15.0, gix-pack v0.33.0, gix-odb v0.43.0, gix-transport v0.28.0, gix-protocol v0.29.0, gix-worktree v0.15.0, gix v0.41.0, safety bump 12 crates ([`29a0870`](https://github.com/Byron/gitoxide/commit/29a087043d1feb2f127b065341c8028d0bd0301e))
+ - Prepare changelogs prior to release ([`e06f5f5`](https://github.com/Byron/gitoxide/commit/e06f5f523e83f4da390eddbebcb9a2d58674587b))
+</details>
+
## 0.14.0 (2023-03-04)
A maintenance release without user-facing changes.
@@ -13,7 +131,7 @@ A maintenance release without user-facing changes.
<csr-read-only-do-not-edit/>
- - 4 commits contributed to the release over the course of 1 calendar day.
+ - 5 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
@@ -25,6 +143,7 @@ A maintenance release without user-facing changes.
<details><summary>view details</summary>
* **Uncategorized**
+ - Release gix-attributes v0.10.0, gix-ref v0.26.0, gix-config v0.18.0, gix-url v0.15.0, gix-credentials v0.11.0, gix-discover v0.15.0, gix-index v0.14.0, gix-mailmap v0.11.0, gix-odb v0.42.0, gix-transport v0.27.0, gix-protocol v0.28.0, gix-revision v0.12.0, gix-refspec v0.9.0, gix-worktree v0.14.0, gix v0.39.0 ([`93e75fe`](https://github.com/Byron/gitoxide/commit/93e75fed454ed8b342231bde4638db90e407ce52))
- Prepare changelogs prior to release ([`895e482`](https://github.com/Byron/gitoxide/commit/895e482badf01e953bb9144001eebd5e1b1c4d84))
- Release gix-features v0.28.0, gix-actor v0.19.0, gix-object v0.28.0, gix-diff v0.28.0, gix-traverse v0.24.0, gix-pack v0.32.0, safety bump 20 crates ([`0f411e9`](https://github.com/Byron/gitoxide/commit/0f411e93ec812592bb9d3a52b751399dd86f76f7))
- Merge branch 'adjustments-for-cargo' ([`04ab852`](https://github.com/Byron/gitoxide/commit/04ab852f3be76bdf151affa25cf4b999b127bdfe))
diff --git a/vendor/gix-index/Cargo.toml b/vendor/gix-index/Cargo.toml
index 87191a09f..d2c4b49a1 100644
--- a/vendor/gix-index/Cargo.toml
+++ b/vendor/gix-index/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.64"
name = "gix-index"
-version = "0.14.0"
+version = "0.16.0"
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
include = [
"src/**/*",
@@ -29,7 +29,7 @@ repository = "https://github.com/Byron/gitoxide"
[package.metadata.docs.rs]
features = [
"document-features",
- "serde1",
+ "dep:serde",
]
rustdoc-args = [
"--cfg",
@@ -41,7 +41,7 @@ test = true
doctest = false
[dependencies.bitflags]
-version = "1.3.2"
+version = "2"
[dependencies.bstr]
version = "1.3.0"
@@ -58,26 +58,26 @@ optional = true
version = "0.2.15"
[dependencies.gix-bitmap]
-version = "^0.2.2"
+version = "^0.2.3"
[dependencies.gix-features]
-version = "^0.28.0"
+version = "^0.29.0"
features = [
"rustsha1",
"progress",
]
[dependencies.gix-hash]
-version = "^0.10.3"
+version = "^0.11.1"
[dependencies.gix-lock]
-version = "^4.0.0"
+version = "^5.0.0"
[dependencies.gix-object]
-version = "^0.28.0"
+version = "^0.29.1"
[dependencies.gix-traverse]
-version = "^0.24.0"
+version = "^0.25.0"
[dependencies.itoa]
version = "1.0.3"
@@ -98,8 +98,8 @@ version = "1.7.0"
version = "1.0.32"
[features]
-serde1 = [
- "serde",
+serde = [
+ "dep:serde",
"smallvec/serde",
- "gix-hash/serde1",
+ "gix-hash/serde",
]
diff --git a/vendor/gix-index/src/access/mod.rs b/vendor/gix-index/src/access/mod.rs
index e8f2dc9f8..fa0215d9f 100644
--- a/vendor/gix-index/src/access/mod.rs
+++ b/vendor/gix-index/src/access/mod.rs
@@ -1,6 +1,7 @@
use std::cmp::Ordering;
use bstr::{BStr, ByteSlice, ByteVec};
+use filetime::FileTime;
use crate::{entry, extension, Entry, PathStorage, State, Version};
@@ -15,6 +16,20 @@ impl State {
self.version
}
+ /// Returns time at which the state was created, indicating its freshness compared to other files on disk.
+ pub fn timestamp(&self) -> FileTime {
+ self.timestamp
+ }
+
+ /// Updates the timestamp of this state, indicating its freshness compared to other files on disk.
+ ///
+ /// Be careful about using this as setting a timestamp without correctly updating the index
+ /// **will cause (file system) race conditions** see racy-git.txt in the git documentation
+ /// for more details.
+ pub fn set_timestamp(&mut self, timestamp: FileTime) {
+ self.timestamp = timestamp
+ }
+
/// Return the kind of hashes used in this instance.
pub fn object_hash(&self) -> gix_hash::Kind {
self.object_hash
@@ -117,6 +132,12 @@ impl State {
pub fn entries_mut(&mut self) -> &mut [Entry] {
&mut self.entries
}
+
+ /// Return a writable slice to entries and read-access to their path storage at the same time.
+ pub fn entries_mut_and_pathbacking(&mut self) -> (&mut [Entry], &PathStorage) {
+ (&mut self.entries, &self.path_backing)
+ }
+
/// Return mutable entries along with their paths in an iterator.
pub fn entries_mut_with_paths(&mut self) -> impl Iterator<Item = (&mut Entry, &BStr)> {
let paths = &self.path_backing;
diff --git a/vendor/gix-index/src/decode/entries.rs b/vendor/gix-index/src/decode/entries.rs
index 0a968ae0c..5de949fe1 100644
--- a/vendor/gix-index/src/decode/entries.rs
+++ b/vendor/gix-index/src/decode/entries.rs
@@ -98,7 +98,7 @@ fn load_one<'a>(
let (size, data) = read_u32(data)?;
let (hash, data) = split_at_pos(data, hash_len)?;
let (flags, data) = read_u16(data)?;
- let flags = entry::at_rest::Flags::from_bits(flags)?;
+ let flags = entry::at_rest::Flags::from_bits_retain(flags);
let (flags, data) = if flags.contains(entry::at_rest::Flags::EXTENDED) {
let (extended_flags, data) = read_u16(data)?;
let extended_flags = entry::at_rest::FlagsExtended::from_bits(extended_flags)?;
@@ -142,11 +142,11 @@ fn load_one<'a>(
Some((
Entry {
stat: entry::Stat {
- ctime: entry::Time {
+ ctime: entry::stat::Time {
secs: ctime_secs,
nsecs: ctime_nsecs,
},
- mtime: entry::Time {
+ mtime: entry::stat::Time {
secs: mtime_secs,
nsecs: mtime_nsecs,
},
diff --git a/vendor/gix-index/src/decode/mod.rs b/vendor/gix-index/src/decode/mod.rs
index e84d8f717..c94b03495 100644
--- a/vendor/gix-index/src/decode/mod.rs
+++ b/vendor/gix-index/src/decode/mod.rs
@@ -302,11 +302,11 @@ pub(crate) fn stat(data: &[u8]) -> Option<(entry::Stat, &[u8])> {
let (size, data) = read_u32(data)?;
Some((
entry::Stat {
- mtime: entry::Time {
+ mtime: entry::stat::Time {
secs: ctime_secs,
nsecs: ctime_nsecs,
},
- ctime: entry::Time {
+ ctime: entry::stat::Time {
secs: mtime_secs,
nsecs: mtime_nsecs,
},
diff --git a/vendor/gix-index/src/entry/flags.rs b/vendor/gix-index/src/entry/flags.rs
index ec00a78db..05198bafb 100644
--- a/vendor/gix-index/src/entry/flags.rs
+++ b/vendor/gix-index/src/entry/flags.rs
@@ -3,24 +3,27 @@ use bitflags::bitflags;
use crate::entry::Stage;
bitflags! {
- /// In-memory flags
+ /// In-memory flags.
+ ///
+ /// Notably, not all of these will be persisted but can be used to aid all kinds of operations.
+ #[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct Flags: u32 {
- /// The mask to apply to obtain the stage number of an entry.
- const STAGE_MASK = 0x3000;
- /// If set, additional bits need to be written to storage.
- const EXTENDED = 0x4000;
// TODO: could we use the pathlen ourselves to save 8 bytes? And how to handle longer paths than that? 0 as sentinel maybe?
- /// The mask to obtain the length of the path associated with this entry.
+ /// The mask to obtain the length of the path associated with this entry, up to 4095 characters without extension.
const PATH_LEN = 0x0fff;
+ /// The mask to apply to obtain the stage number of an entry, encoding three value: 0 = base, 1 = ours, 2 = theirs.
+ const STAGE_MASK = 1<<12 | 1<<13;
+ /// If set, additional bits need to be written to storage.
+ const EXTENDED = 1<<14;
/// If set, the entry be assumed to match with the version on the working tree, as a way to avoid `lstat()` checks.
const ASSUME_VALID = 1 << 15;
/// Indicates that an entry needs to be updated as it's in-memory representation doesn't match what's on disk.
const UPDATE = 1 << 16;
/// Indicates an entry should be removed - this typically happens during writing, by simply skipping over them.
const REMOVE = 1 << 17;
- /// Indicates that an entry is known to be uptodate.
+ /// Indicates that an entry is known to be up-to-date.
const UPTODATE = 1 << 18;
- /// Only temporarily used by unpack_trees() (in C)
+ /// Only temporarily used by unpack_trees() (in C).
const ADDED = 1 << 19;
/// Whether an up-to-date object hash exists for the entry.
@@ -45,8 +48,8 @@ bitflags! {
/// Indicates the entry name is present in the base/shared index, and thus doesn't have to be stored in this one.
const STRIP_NAME = 1 << 28;
- ///
- /// stored at rest, see at_rest::FlagsExtended
+ /// Created with `git add --intent-to-add` to mark empty entries that have their counter-part in the worktree, but not
+ /// yet in the object database.
const INTENT_TO_ADD = 1 << 29;
/// Stored at rest
const SKIP_WORKTREE = 1 << 30;
@@ -59,21 +62,20 @@ bitflags! {
impl Flags {
/// Return the stage as extracted from the bits of this instance.
pub fn stage(&self) -> Stage {
- (*self & Flags::STAGE_MASK).bits >> 12
+ (*self & Flags::STAGE_MASK).bits() >> 12
}
/// Transform ourselves to a storage representation to keep all flags which are to be persisted,
/// skipping all extended flags. Note that the caller has to check for the `EXTENDED` bit to be present
/// and write extended flags as well if so.
pub fn to_storage(mut self) -> at_rest::Flags {
- at_rest::Flags::from_bits(
+ at_rest::Flags::from_bits_retain(
{
self.remove(Self::PATH_LEN);
self
}
.bits() as u16,
)
- .unwrap()
}
}
@@ -82,6 +84,7 @@ pub(crate) mod at_rest {
bitflags! {
/// Flags how they are serialized to a storage location
+ #[derive(Copy, Clone, Debug)]
pub struct Flags: u16 {
/// A portion of a the flags that encodes the length of the path that follows.
const PATH_LEN = 0x0fff;
@@ -95,12 +98,13 @@ pub(crate) mod at_rest {
impl Flags {
pub fn to_memory(self) -> super::Flags {
- super::Flags::from_bits(self.bits as u32).expect("PATHLEN is part of memory representation")
+ super::Flags::from_bits_retain(self.bits() as u32)
}
}
bitflags! {
/// Extended flags - add flags for serialization here and offset them down to u16.
+ #[derive(Copy, Clone, Debug, PartialEq)]
pub struct FlagsExtended: u16 {
const INTENT_TO_ADD = 1 << (29 - 16);
const SKIP_WORKTREE = 1 << (30 - 16);
@@ -109,11 +113,12 @@ pub(crate) mod at_rest {
impl FlagsExtended {
pub fn from_flags(flags: super::Flags) -> Self {
- Self::from_bits(((flags & (super::Flags::INTENT_TO_ADD | super::Flags::SKIP_WORKTREE)).bits >> 16) as u16)
- .expect("valid")
+ Self::from_bits_retain(
+ ((flags & (super::Flags::INTENT_TO_ADD | super::Flags::SKIP_WORKTREE)).bits() >> 16) as u16,
+ )
}
pub fn to_flags(self) -> Option<super::Flags> {
- super::Flags::from_bits((self.bits as u32) << 16)
+ super::Flags::from_bits((self.bits() as u32) << 16)
}
}
@@ -122,9 +127,21 @@ pub(crate) mod at_rest {
use super::*;
#[test]
+ fn flags_extended_conversion() {
+ assert_eq!(
+ FlagsExtended::all().to_flags(),
+ Some(super::super::Flags::INTENT_TO_ADD | super::super::Flags::SKIP_WORKTREE)
+ );
+ assert_eq!(
+ FlagsExtended::from_flags(super::super::Flags::all()),
+ FlagsExtended::all()
+ );
+ }
+
+ #[test]
fn flags_from_bits_with_conflict() {
let input = 0b1110_0010_1000_1011;
- assert_eq!(Flags::from_bits(input).unwrap().bits, input);
+ assert_eq!(Flags::from_bits_retain(input).bits(), input);
}
}
}
diff --git a/vendor/gix-index/src/entry/mod.rs b/vendor/gix-index/src/entry/mod.rs
index 165df801e..e680e08b0 100644
--- a/vendor/gix-index/src/entry/mod.rs
+++ b/vendor/gix-index/src/entry/mod.rs
@@ -1,33 +1,48 @@
/// The stage of an entry, one of 0 = base, 1 = ours, 2 = theirs
pub type Stage = u32;
-mod mode;
-pub use mode::Mode;
+///
+pub mod mode;
mod flags;
pub(crate) use flags::at_rest;
pub use flags::Flags;
+///
+pub mod stat;
mod write;
-/// The time component in a [`Stat`] struct.
-#[derive(Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
-pub struct Time {
- /// The amount of seconds elapsed since EPOCH
- pub secs: u32,
- /// The amount of nanoseconds elapsed in the current second, ranging from 0 to 999.999.999 .
- pub nsecs: u32,
+use bitflags::bitflags;
+
+// TODO: we essentially treat this as an enum withj the only exception being
+// that `FILE_EXECUTABLE.contains(FILE)` works might want to turn this into an
+// enum proper
+bitflags! {
+ /// The kind of file of an entry.
+ #[derive(Copy, Clone, Debug, PartialEq, Eq)]
+ pub struct Mode: u32 {
+ /// directory (only used for sparse checkouts), equivalent to a tree, which is _excluded_ from the index via
+ /// cone-mode.
+ const DIR = 0o040000;
+ /// regular file
+ const FILE = 0o100644;
+ /// regular file, executable
+ const FILE_EXECUTABLE = 0o100755;
+ /// Symbolic link
+ const SYMLINK = 0o120000;
+ /// A git commit for submodules
+ const COMMIT = 0o160000;
+ }
}
/// An entry's filesystem stat information.
#[derive(Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Stat {
/// Modification time
- pub mtime: Time,
+ pub mtime: stat::Time,
/// Creation time
- pub ctime: Time,
+ pub ctime: stat::Time,
/// Device number
pub dev: u32,
/// Inode number
@@ -64,29 +79,11 @@ mod access {
}
mod _impls {
- use std::{cmp::Ordering, ops::Add, time::SystemTime};
+ use std::cmp::Ordering;
use bstr::BStr;
- use crate::{entry::Time, Entry, State};
-
- impl From<SystemTime> for Time {
- fn from(s: SystemTime) -> Self {
- let d = s
- .duration_since(std::time::UNIX_EPOCH)
- .expect("system time is not before unix epoch!");
- Time {
- secs: d.as_secs() as u32,
- nsecs: d.subsec_nanos(),
- }
- }
- }
-
- impl From<Time> for SystemTime {
- fn from(s: Time) -> Self {
- std::time::UNIX_EPOCH.add(std::time::Duration::new(s.secs.into(), s.nsecs))
- }
- }
+ use crate::{Entry, State};
impl Entry {
/// Compare one entry to another by their path, by comparing only their common path portion byte by byte, then resorting to
diff --git a/vendor/gix-index/src/entry/mode.rs b/vendor/gix-index/src/entry/mode.rs
index 1045dfd5b..7d3fdf506 100644
--- a/vendor/gix-index/src/entry/mode.rs
+++ b/vendor/gix-index/src/entry/mode.rs
@@ -1,24 +1,95 @@
-use bitflags::bitflags;
-bitflags! {
- /// The kind of file of an entry.
- pub struct Mode: u32 {
- /// directory (only used for sparse checkouts), equivalent to a tree, which is _excluded_ from the index via
- /// cone-mode.
- const DIR = 0o040000;
- /// regular file
- const FILE = 0o100644;
- /// regular file, executable
- const FILE_EXECUTABLE = 0o100755;
- /// Symbolic link
- const SYMLINK = 0o120000;
- /// A git commit for submodules
- const COMMIT = 0o160000;
- }
+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
}
+
+ /// 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.
+ ///
+ /// * if `has_symlinks` is false symlink entries will simply check if there
+ /// is a normal file on disk
+ /// * if `executable_bit` is false the executable bit will not be compared
+ /// `Change::ExecutableBit` will never be generated
+ ///
+ /// If there is a type change then we will use whatever information is
+ /// present on the FS. Specifically if `has_symlinks` is false we will
+ /// never generate `Change::TypeChange { new_mode: Mode::SYMLINK }`. and
+ /// iff `executable_bit` is false we will never generate `Change::TypeChange
+ /// { new_mode: Mode::FILE_EXECUTABLE }` (all files are assumed to be not
+ /// executable). That measn that unstaging and staging files can be a lossy
+ /// operation on such file systems.
+ ///
+ /// If a directory replaced a normal file/symlink we assume that the
+ /// directory is a submodule. Normal (non-submodule) directories would
+ /// cause a file to be deleted from the index and should be handled before
+ /// calling this function.
+ ///
+ /// If the stat information belongs to something other than a normal file/
+ /// directory (like a socket) we just return an identity change (non-files
+ /// can not be committed to git).
+ pub fn change_to_match_fs(
+ self,
+ stat: &std::fs::Metadata,
+ has_symlinks: bool,
+ executable_bit: bool,
+ ) -> Option<Change> {
+ match self {
+ Mode::FILE if !stat.is_file() => (),
+ 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),
+ _ => return None,
+ };
+ let new_mode = if stat.is_dir() {
+ Mode::COMMIT
+ } else if executable_bit && is_executable(stat) {
+ Mode::FILE_EXECUTABLE
+ } else {
+ Mode::FILE
+ };
+ Some(Change::Type { new_mode })
+ }
+}
+
+/// A change of a [`Mode`].
+pub enum Change {
+ /// The type of mode changed, like symlink => file.
+ Type {
+ /// The mode representing the new index type.
+ new_mode: Mode,
+ },
+ /// The executable permission of this file has changed.
+ ExecutableBit,
+}
+
+impl Change {
+ /// Applies this change to `mode` and returns the changed one.
+ pub fn apply(self, mode: Mode) -> Mode {
+ match self {
+ Change::Type { new_mode } => new_mode,
+ Change::ExecutableBit => match mode {
+ Mode::FILE => Mode::FILE_EXECUTABLE,
+ Mode::FILE_EXECUTABLE => Mode::FILE,
+ _ => unreachable!("invalid mode change: can't flip executable bit of {mode:?}"),
+ },
+ }
+ }
}
diff --git a/vendor/gix-index/src/entry/stat.rs b/vendor/gix-index/src/entry/stat.rs
new file mode 100644
index 000000000..eb537cf58
--- /dev/null
+++ b/vendor/gix-index/src/entry/stat.rs
@@ -0,0 +1,201 @@
+use std::{
+ cmp::Ordering,
+ time::{SystemTime, SystemTimeError},
+};
+
+use filetime::FileTime;
+
+use crate::entry::Stat;
+
+impl Stat {
+ /// Detect whether this stat entry is racy if stored in a file index with `timestamp`.
+ ///
+ /// An index entry is considered racy if it's `mtime` is larger or equal to the index `timestamp`.
+ /// The index `timestamp` marks the point in time before which we definitely resolved the racy git problem
+ /// for all index entries so any index entries that changed afterwards will need to be examined for
+ /// changes by actually reading the file from disk at least once.
+ pub fn is_racy(
+ &self,
+ timestamp: FileTime,
+ Options {
+ check_stat, use_nsec, ..
+ }: Options,
+ ) -> bool {
+ match timestamp.unix_seconds().cmp(&(self.mtime.secs as i64)) {
+ Ordering::Less => true,
+ Ordering::Equal if use_nsec && check_stat => timestamp.nanoseconds() <= self.mtime.nsecs,
+ Ordering::Equal => true,
+ Ordering::Greater => false,
+ }
+ }
+
+ /// Compares the stat information of two index entries.
+ ///
+ /// Intuitively this is basically equivalent to `self == other`.
+ /// However there a lot of nobs in git that tweak whether certain stat information is used when checking
+ /// equality, see [`Options`].
+ /// This function respects those options while performing the stat comparison and may therefore ignore some fields.
+ pub fn matches(
+ &self,
+ other: &Self,
+ Options {
+ trust_ctime,
+ check_stat,
+ use_nsec,
+ use_stdev,
+ }: Options,
+ ) -> bool {
+ if self.mtime.secs != other.mtime.secs {
+ return false;
+ }
+ if check_stat && use_nsec && self.mtime.nsecs != other.mtime.nsecs {
+ return false;
+ }
+
+ if self.size != other.size {
+ return false;
+ }
+
+ if trust_ctime {
+ if self.ctime.secs != other.ctime.secs {
+ return false;
+ }
+ if check_stat && use_nsec && self.ctime.nsecs != other.ctime.nsecs {
+ return false;
+ }
+ }
+
+ if check_stat {
+ if use_stdev && self.dev != other.dev {
+ return false;
+ }
+ self.ino == other.ino && self.gid == other.gid && self.uid == other.uid
+ } else {
+ true
+ }
+ }
+
+ /// Creates stat information from the result of symlink_metadata.
+ pub fn from_fs(fstat: &std::fs::Metadata) -> Result<Stat, SystemTimeError> {
+ let mtime = fstat.modified().unwrap_or(std::time::UNIX_EPOCH);
+ let ctime = fstat.created().unwrap_or(std::time::UNIX_EPOCH);
+
+ #[cfg(not(unix))]
+ let res = Stat {
+ mtime: mtime.try_into()?,
+ ctime: ctime.try_into()?,
+ dev: 0,
+ ino: 0,
+ uid: 0,
+ gid: 0,
+ // truncation to 32 bits is on purpose (git does the same).
+ size: fstat.len() as u32,
+ };
+ #[cfg(unix)]
+ use std::os::unix::fs::MetadataExt;
+ #[cfg(unix)]
+ let res = Stat {
+ mtime: mtime.try_into()?,
+ ctime: ctime.try_into()?,
+ // truncating to 32 bits is fine here because
+ // that's what the linux syscalls returns
+ // just rust upcasts to 64 bits for some reason?
+ // numbers this large are impractical anyway (that's a lot of hard-drives).
+ dev: fstat.dev() as u32,
+ ino: fstat.ino() as u32,
+ uid: fstat.uid(),
+ gid: fstat.gid(),
+ // truncation to 32 bits is on purpose (git does the same).
+ size: fstat.len() as u32,
+ };
+
+ Ok(res)
+ }
+}
+
+impl TryFrom<SystemTime> for Time {
+ type Error = SystemTimeError;
+ fn try_from(s: SystemTime) -> Result<Self, SystemTimeError> {
+ let d = s.duration_since(std::time::UNIX_EPOCH)?;
+ Ok(Time {
+ // truncation to 32 bits is on purpose (we only compare the low bits)
+ secs: d.as_secs() as u32,
+ nsecs: d.subsec_nanos(),
+ })
+ }
+}
+
+impl From<Time> for SystemTime {
+ fn from(s: Time) -> Self {
+ std::time::UNIX_EPOCH + std::time::Duration::new(s.secs.into(), s.nsecs)
+ }
+}
+
+/// The time component in a [`Stat`] struct.
+#[derive(Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
+pub struct Time {
+ /// The amount of seconds elapsed since EPOCH.
+ pub secs: u32,
+ /// The amount of nanoseconds elapsed in the current second, ranging from 0 to 999.999.999 .
+ pub nsecs: u32,
+}
+
+impl From<FileTime> for Time {
+ fn from(value: FileTime) -> Self {
+ Time {
+ secs: value.unix_seconds().try_into().expect("can't represent non-unix times"),
+ nsecs: value.nanoseconds(),
+ }
+ }
+}
+
+impl PartialEq<FileTime> for Time {
+ fn eq(&self, other: &FileTime) -> bool {
+ *self == Time::from(*other)
+ }
+}
+
+impl PartialOrd<FileTime> for Time {
+ fn partial_cmp(&self, other: &FileTime) -> Option<Ordering> {
+ self.partial_cmp(&Time::from(*other))
+ }
+}
+
+/// Configuration for comparing stat entries
+#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
+pub struct Options {
+ /// If true, a files creation time is taken into consideration when checking if a file changed.
+ /// Can be set to false in case other tools alter the creation time in ways that interfere with our operation.
+ ///
+ /// Default `true`.
+ pub trust_ctime: bool,
+ /// If true, all stat fields will be used when checking for up-to-date'ness of the entry. Otherwise
+ /// nano-second parts of mtime and ctime,uid, gid, inode and device number _will not_ be used, leaving only
+ /// the whole-second part of ctime and mtime and the file size to be checked.
+ ///
+ /// Default `true`.
+ pub check_stat: bool,
+ /// Whether to compare nano secs when comparing timestamps. This currently
+ /// leads to many false positives on linux and is therefore disabled there.
+ ///
+ /// Default `false`
+ pub use_nsec: bool,
+ /// Whether to compare network devices secs when comparing timestamps.
+ /// Disabled by default because this can cause many false positives on network
+ /// devices where the device number is not stable
+ ///
+ /// Default `false`.
+ pub use_stdev: bool,
+}
+
+impl Default for Options {
+ fn default() -> Self {
+ Self {
+ trust_ctime: true,
+ check_stat: true,
+ use_nsec: false,
+ use_stdev: false,
+ }
+ }
+}
diff --git a/vendor/gix-index/src/lib.rs b/vendor/gix-index/src/lib.rs
index d8451c545..1fb1f6800 100644
--- a/vendor/gix-index/src/lib.rs
+++ b/vendor/gix-index/src/lib.rs
@@ -35,7 +35,7 @@ pub mod write;
/// All known versions of a git index file.
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Version {
/// Supports entries and various extensions.
V2 = 2,
@@ -91,11 +91,12 @@ pub struct State {
///
/// Note that on platforms that only have a precisions of a second for this time, we will treat all entries with the
/// same timestamp as this as potentially changed, checking more thoroughly if a change actually happened.
- #[allow(dead_code)]
timestamp: FileTime,
version: Version,
entries: Vec<Entry>,
/// A memory area keeping all index paths, in full length, independently of the index version.
+ ///
+ /// Ranges into this storage are referred to by parts of `entries`.
path_backing: PathStorage,
/// True if one entry in the index has a special marker mode
is_sparse: bool,
@@ -196,6 +197,6 @@ fn size_of_entry() {
assert_eq!(std::mem::size_of::<crate::Entry>(), 80);
// the reason we have our own time is half the size.
- assert_eq!(std::mem::size_of::<crate::entry::Time>(), 8);
+ assert_eq!(std::mem::size_of::<crate::entry::stat::Time>(), 8);
assert_eq!(std::mem::size_of::<filetime::FileTime>(), 16);
}
diff --git a/vendor/gix-index/src/write.rs b/vendor/gix-index/src/write.rs
index 23643734c..43f9b3255 100644
--- a/vendor/gix-index/src/write.rs
+++ b/vendor/gix-index/src/write.rs
@@ -3,9 +3,10 @@ use std::{convert::TryInto, io::Write};
use crate::{entry, extension, write::util::CountBytes, State, Version};
/// A way to specify which of the optional extensions to write.
-#[derive(Debug, Copy, Clone)]
+#[derive(Default, Debug, Copy, Clone)]
pub enum Extensions {
/// Writes all available optional extensions to avoid loosing any information.
+ #[default]
All,
/// Only write the given optional extensions, with each extension being marked by a boolean flag.
///
@@ -23,12 +24,6 @@ pub enum Extensions {
None,
}
-impl Default for Extensions {
- fn default() -> Self {
- Extensions::All
- }
-}
-
impl Extensions {
/// Returns `Some(signature)` if it should be written out.
pub fn should_write(&self, signature: extension::Signature) -> Option<extension::Signature> {