From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/gix-odb/.cargo-checksum.json | 2 +- vendor/gix-odb/CHANGELOG.md | 144 ++++++++++++++++++++++- vendor/gix-odb/Cargo.toml | 24 ++-- vendor/gix-odb/src/lib.rs | 3 +- vendor/gix-odb/src/sink.rs | 36 +++--- vendor/gix-odb/src/store_impls/dynamic/iter.rs | 9 +- vendor/gix-odb/src/store_impls/dynamic/mod.rs | 13 +- vendor/gix-odb/src/store_impls/dynamic/types.rs | 2 +- vendor/gix-odb/src/store_impls/dynamic/verify.rs | 8 +- vendor/gix-odb/src/store_impls/loose/verify.rs | 2 +- vendor/gix-odb/src/store_impls/loose/write.rs | 41 ++++++- 11 files changed, 225 insertions(+), 59 deletions(-) (limited to 'vendor/gix-odb') diff --git a/vendor/gix-odb/.cargo-checksum.json b/vendor/gix-odb/.cargo-checksum.json index cef2ac007..3c0684e60 100644 --- a/vendor/gix-odb/.cargo-checksum.json +++ b/vendor/gix-odb/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"3f3de3d64895536d0c78ab2d34f16d39c368fa5d288307c0680f58b3c7764e71","Cargo.toml":"cb8e306c9a375ed4f2e266e98316742c028eff32ae00878e239a875e643172af","src/alternate/mod.rs":"02d29b6fbc6f4801a657882e19c01fa4aa7e7fd0f10dd25c8c040412468bb1de","src/alternate/parse.rs":"418f5c54d6293ceb886d44a3482dd3a2378d50031ff04186541c5e09be2eedcc","src/cache.rs":"b33c52a0ee7370ad9e81aed40cf74a9df8b60228edf0f2ea765112a7be130b9c","src/find.rs":"270a843d766f9f1641884c173d820c34ed8c59fa4dd6bce04f465b51888433d5","src/lib.rs":"2faebfc86388e0eeee119df148a616658d746e02d1cfe29c5417399d340ec3eb","src/sink.rs":"49b09d47c8194909781ce0a1d3ab55e5d411a8565ee105bc7d2e97b0531a5b12","src/store_impls/dynamic/access.rs":"0c1d4762953f76abc317e66261f3a5911c4bfcfe92ce75d22f69080a7e229501","src/store_impls/dynamic/find.rs":"63602bddfa71d3d5ee32cc258a36df8368621ed523a13479b69f28b1e04940aa","src/store_impls/dynamic/handle.rs":"fd203474b9097f19ab2ddabece78ed8abcb1a3e014475d814f8ff8da6ce42a07","src/store_impls/dynamic/header.rs":"9105fb3b11d73855b9bfc0309b2a0ba278bd3f86b93bedf01f6a2ee737565f00","src/store_impls/dynamic/init.rs":"4e701654bc265205dc9fcb9fa7eb848c99ce10d2c65e6254b7837a537102f1f3","src/store_impls/dynamic/iter.rs":"f4e52bb93946e5cd288097986cb50e7dc7cbdc8f6a0ac05099a90422682f508d","src/store_impls/dynamic/load_index.rs":"39155811df403cc3c51c7a953d94e3012098635932d78d9c985720d232127032","src/store_impls/dynamic/load_one.rs":"fa0393f14a653d9116c7b470219175cccffa8bb2e981afc89d62a48778a6d825","src/store_impls/dynamic/metrics.rs":"493f87f5bf72a23825c7c002f47edc286fff670ee3eb0ebdc60f52f131e674a4","src/store_impls/dynamic/mod.rs":"e70dc44156f5e9ef53fcb98892157f8a372d96a0946b70a736cf7f461386ed18","src/store_impls/dynamic/prefix.rs":"b1cd60744a3ae5d46c9f8388259504b8d106b3226283df7a77ba0ff42e43a0d4","src/store_impls/dynamic/types.rs":"c49e6ab0719a40bdee082da3d4169e5bf6be47f47cc695b4c343b87a4e21b1f6","src/store_impls/dynamic/verify.rs":"23938920dca4baa9bf604ead7756fec23b4afdc361fa6ad44f47cae72fa32d08","src/store_impls/dynamic/write.rs":"b281fbbc349377a7bd73b68370f7a508cddf35db4e1d4409fc0fff0ca8386d43","src/store_impls/loose/find.rs":"749273a7a3f82e889c7869ff6b1c6861d89c929ec4947ec5b358b002ff95b605","src/store_impls/loose/iter.rs":"52dd3df3148aa057efcbb2c86bb631834cbe9afdfb4a487fb6d1fe3e947b2c86","src/store_impls/loose/mod.rs":"9008a952ad41b7a9672028b6dd6d7fd613328694657f13e55ef078872ab8975e","src/store_impls/loose/verify.rs":"bbb840caca926d89d91c786ca232e3ae841eb16d44f7f5a9229bcd2198e2f7f8","src/store_impls/loose/write.rs":"7102a7248b169d9e783e3ba55c2f11a654abb0d51ce5f0308be3fc0eb3fa0f52","src/store_impls/mod.rs":"d5f123c2037dd5ee538721ad626aebf845d445d43438c3e10daac34d73fdc779","src/traits.rs":"9f77ef94dd7e021cceda22ba0929b6fa3a2e888acfd54f0dd4e8d6418dbda2b7"},"package":"e9a5f9e1afbd509761977a2ea02869cedaaba500b4e783deb2e4de5179a55a80"} \ No newline at end of file +{"files":{"CHANGELOG.md":"ad26d6e5400f3338f52b9f3623d0bb1f33393b738ded4dd4a04b272b7aac2338","Cargo.toml":"11a6ede68c573f9b5ba23cbf922f7118e8f1449ccf654989595b6128f698af81","src/alternate/mod.rs":"02d29b6fbc6f4801a657882e19c01fa4aa7e7fd0f10dd25c8c040412468bb1de","src/alternate/parse.rs":"418f5c54d6293ceb886d44a3482dd3a2378d50031ff04186541c5e09be2eedcc","src/cache.rs":"b33c52a0ee7370ad9e81aed40cf74a9df8b60228edf0f2ea765112a7be130b9c","src/find.rs":"270a843d766f9f1641884c173d820c34ed8c59fa4dd6bce04f465b51888433d5","src/lib.rs":"e6c245c55708864e399d74368ee2ebcb9ae43852794b0c39e0d3e41ce6f0efea","src/sink.rs":"812541c306c27d036bfd3f90bcc9b620992c18ae49fc808ee7c86a7bde98ab20","src/store_impls/dynamic/access.rs":"0c1d4762953f76abc317e66261f3a5911c4bfcfe92ce75d22f69080a7e229501","src/store_impls/dynamic/find.rs":"63602bddfa71d3d5ee32cc258a36df8368621ed523a13479b69f28b1e04940aa","src/store_impls/dynamic/handle.rs":"fd203474b9097f19ab2ddabece78ed8abcb1a3e014475d814f8ff8da6ce42a07","src/store_impls/dynamic/header.rs":"9105fb3b11d73855b9bfc0309b2a0ba278bd3f86b93bedf01f6a2ee737565f00","src/store_impls/dynamic/init.rs":"4e701654bc265205dc9fcb9fa7eb848c99ce10d2c65e6254b7837a537102f1f3","src/store_impls/dynamic/iter.rs":"bed742ace9aaee98aeccf6a8d498372f908fcbcc8649d6c7f0c2c96029a21fa8","src/store_impls/dynamic/load_index.rs":"39155811df403cc3c51c7a953d94e3012098635932d78d9c985720d232127032","src/store_impls/dynamic/load_one.rs":"fa0393f14a653d9116c7b470219175cccffa8bb2e981afc89d62a48778a6d825","src/store_impls/dynamic/metrics.rs":"493f87f5bf72a23825c7c002f47edc286fff670ee3eb0ebdc60f52f131e674a4","src/store_impls/dynamic/mod.rs":"96c2616d9809b33bf1a95be2da3feaf36c529bf32fc1cfea97a90856f916d8c3","src/store_impls/dynamic/prefix.rs":"b1cd60744a3ae5d46c9f8388259504b8d106b3226283df7a77ba0ff42e43a0d4","src/store_impls/dynamic/types.rs":"24eb6eba36c27ad49fba6edf2f5cbea1c837ae6b3ff2f05cc89117cdd8bb93b5","src/store_impls/dynamic/verify.rs":"2a9ad04e0cbaffa12752a16de6a3e4acb7e2fcfd5a52bbd4409c21713910de34","src/store_impls/dynamic/write.rs":"b281fbbc349377a7bd73b68370f7a508cddf35db4e1d4409fc0fff0ca8386d43","src/store_impls/loose/find.rs":"749273a7a3f82e889c7869ff6b1c6861d89c929ec4947ec5b358b002ff95b605","src/store_impls/loose/iter.rs":"52dd3df3148aa057efcbb2c86bb631834cbe9afdfb4a487fb6d1fe3e947b2c86","src/store_impls/loose/mod.rs":"9008a952ad41b7a9672028b6dd6d7fd613328694657f13e55ef078872ab8975e","src/store_impls/loose/verify.rs":"0170696d3bdf9be8c13ea4d236bda6c01efec8b8c627cbbfdb264457b0b1978b","src/store_impls/loose/write.rs":"ca7b307672c1eff65385a7675e01edcfc8ffcf5ceb085ea9efad813c6c09ae47","src/store_impls/mod.rs":"d5f123c2037dd5ee538721ad626aebf845d445d43438c3e10daac34d73fdc779","src/traits.rs":"9f77ef94dd7e021cceda22ba0929b6fa3a2e888acfd54f0dd4e8d6418dbda2b7"},"package":"bca2f324aa67672b6d0f2c0fa93f96eb6a7029d260e4c1df5dce3c015f5e5add"} \ No newline at end of file diff --git a/vendor/gix-odb/CHANGELOG.md b/vendor/gix-odb/CHANGELOG.md index a3e4bd266..bb65bedfd 100644 --- a/vendor/gix-odb/CHANGELOG.md +++ b/vendor/gix-odb/CHANGELOG.md @@ -5,7 +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.42.0 (2023-03-04) +## 0.45.0 (2023-04-27) + +A maintenance release without user-facing changes. + +### Commit Statistics + + + + - 2 commits contributed to the release. + - 0 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 ([`0135158`](https://github.com/Byron/gitoxide/commit/013515897215400539bfd53c25548bd054186ba6)) + - Bump gix-path v0.8.0, safety bump 20 crates (gix set to 0.44.1 manually) ([`43ebaf2`](https://github.com/Byron/gitoxide/commit/43ebaf267557218865862538ffc7bdf00558492f)) +
+ +## 0.44.0 (2023-04-26) + +### Bug Fixes + + - set permissions of newly written loose objects to be similar to `git`. + Note that the current implementation lacks all of the sophistication that git + applies, and doing this properly definitely takes more work as we would need + to support `core.sharedRepository`. + + Further, our tempfile implementation doesn't allow the setup of file modes + right when it matters, so that could mean quite some work to either workaround + or contribute. + - collisions of newly written object's don't trigger collisions anymore. + It's solved by special-casing windows and assume that certain kinds of filesystem errors + are the result of a collision (with some degree of concurrency/contention). + +### New Features (BREAKING) + + - 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 + + + + - 15 commits contributed to the release over the course of 14 calendar days. + - 27 days passed between releases. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 2 unique issues were worked on: [#814](https://github.com/Byron/gitoxide/issues/814), [#819](https://github.com/Byron/gitoxide/issues/819) + +### Thanks Clippy + + + +[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic. + +### Commit Details + + + +
view details + + * **[#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)) + * **[#819](https://github.com/Byron/gitoxide/issues/819)** + - Collisions of newly written object's don't trigger collisions anymore. ([`416cecc`](https://github.com/Byron/gitoxide/commit/416ceccf7eaf1946efed5a2c95461a2690ae367a)) + * **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 ([`d7173b2`](https://github.com/Byron/gitoxide/commit/d7173b2d2cb79685fdf7f618c31c576db24fa648)) + - 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)) + - Merge branch 'fix-819' ([`69faad0`](https://github.com/Byron/gitoxide/commit/69faad0d7cc100de54d757d42acc152a22edc022)) + - Set permissions of newly written loose objects to be similar to `git`. ([`07e11cf`](https://github.com/Byron/gitoxide/commit/07e11cf210682337f777f1cbbc0d25794c1179ca)) + - Make empty `sink` module non-public. ([`45a0ac1`](https://github.com/Byron/gitoxide/commit/45a0ac192dd15500d577838e850edb56187f42c2)) + - 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)) + - 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)) + - Release gix-hash v0.10.4, gix-hashtable v0.1.3 ([`b574a39`](https://github.com/Byron/gitoxide/commit/b574a3904203762a6b9e475e16a7c358d7616599)) +
+ +## 0.43.1 (2023-03-30) + +### Documentation + + - fix minor typos + +### Commit Statistics + + + + - 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 + + + +
view details + + * **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)) +
+ +## 0.43.0 (2023-03-10) A maintenance release without user-facing changes. @@ -14,6 +131,30 @@ A maintenance release without user-facing changes. - 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 + + + +
view details + + * **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)) +
+ +## 0.42.0 (2023-03-04) + +A maintenance release without user-facing changes. + +### Commit Statistics + + + + - 3 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 @@ -25,6 +166,7 @@ A maintenance release without user-facing changes.
view details * **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))
diff --git a/vendor/gix-odb/Cargo.toml b/vendor/gix-odb/Cargo.toml index 3902cf5d8..4b87c07ef 100644 --- a/vendor/gix-odb/Cargo.toml +++ b/vendor/gix-odb/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.64" name = "gix-odb" -version = "0.42.0" +version = "0.45.0" authors = ["Sebastian Thiel "] include = [ "src/**/*", @@ -26,7 +26,7 @@ repository = "https://github.com/Byron/gitoxide" [package.metadata.docs.rs] features = [ "document-features", - "serde1", + "serde", ] rustdoc-args = [ "--cfg", @@ -54,7 +54,7 @@ version = "0.2.0" optional = true [dependencies.gix-features] -version = "^0.28.0" +version = "^0.29.0" features = [ "rustsha1", "walkdir", @@ -63,16 +63,16 @@ features = [ ] [dependencies.gix-hash] -version = "^0.10.2" +version = "^0.11.1" [dependencies.gix-object] -version = "^0.28.0" +version = "^0.29.1" [dependencies.gix-pack] -version = "^0.32.0" +version = "^0.35.0" [dependencies.gix-path] -version = "^0.7.1" +version = "^0.8.0" [dependencies.gix-quote] version = "^0.4.3" @@ -106,9 +106,9 @@ version = "1.0.0" [features] internal-testing-gix-features-parallel = ["gix-features/parallel"] -serde1 = [ - "serde", - "gix-hash/serde1", - "gix-object/serde1", - "gix-pack/serde1", +serde = [ + "dep:serde", + "gix-hash/serde", + "gix-object/serde", + "gix-pack/serde", ] diff --git a/vendor/gix-odb/src/lib.rs b/vendor/gix-odb/src/lib.rs index a63ea544f..08b14238c 100644 --- a/vendor/gix-odb/src/lib.rs +++ b/vendor/gix-odb/src/lib.rs @@ -65,8 +65,7 @@ pub fn sink(object_hash: gix_hash::Kind) -> Sink { } } -/// -pub mod sink; +mod sink; /// pub mod find; diff --git a/vendor/gix-odb/src/sink.rs b/vendor/gix-odb/src/sink.rs index 1befd6fdf..44a406151 100644 --- a/vendor/gix-odb/src/sink.rs +++ b/vendor/gix-odb/src/sink.rs @@ -30,7 +30,6 @@ impl crate::traits::Write for Sink { mut from: impl io::Read, ) -> Result { let mut size = size.try_into().expect("object size to fit into usize"); - use gix_features::hash::Sha1; let mut buf = [0u8; 8096]; let header = gix_object::encode::loose_header(kind, size); @@ -40,27 +39,24 @@ impl crate::traits::Write for Sink { } Ok(()) }; - match self.object_hash { - gix_hash::Kind::Sha1 => { - let mut hasher = Sha1::default(); - hasher.update(&header); - possibly_compress(&header)?; - while size != 0 { - let bytes = size.min(buf.len()); - from.read_exact(&mut buf[..bytes])?; - hasher.update(&buf[..bytes]); - possibly_compress(&buf[..bytes])?; - size -= bytes; - } - if let Some(compressor) = self.compressor.as_ref() { - let mut c = compressor.borrow_mut(); - c.flush()?; - c.reset(); - } + let mut hasher = gix_features::hash::hasher(self.object_hash); + hasher.update(&header); + possibly_compress(&header)?; - Ok(hasher.digest().into()) - } + while size != 0 { + let bytes = size.min(buf.len()); + from.read_exact(&mut buf[..bytes])?; + hasher.update(&buf[..bytes]); + possibly_compress(&buf[..bytes])?; + size -= bytes; + } + if let Some(compressor) = self.compressor.as_ref() { + let mut c = compressor.borrow_mut(); + c.flush()?; + c.reset(); } + + Ok(hasher.digest().into()) } } diff --git a/vendor/gix-odb/src/store_impls/dynamic/iter.rs b/vendor/gix-odb/src/store_impls/dynamic/iter.rs index bbe859e7c..2152dff71 100644 --- a/vendor/gix-odb/src/store_impls/dynamic/iter.rs +++ b/vendor/gix-odb/src/store_impls/dynamic/iter.rs @@ -30,7 +30,7 @@ enum State { } /// Define the order in which objects are returned. -#[derive(Debug, Copy, Clone)] +#[derive(Default, Debug, Copy, Clone)] pub enum Ordering { /// Traverse packs first as sorted by their index files in lexicographical order (sorted by object id), then traverse loose objects /// as sorted by their names as well. @@ -38,6 +38,7 @@ pub enum Ordering { /// This mode uses no memory as it's the natural ordering of objects, and is best to obtain all object ids as quickly as possible, /// while noting that these may contain duplicates. However, it's very costly to obtain object information or decode them with this /// scheme as cache-hits are unlikely with it and memory maps are less efficient when loading them in random order. + #[default] PackLexicographicalThenLooseLexicographical, /// Traverse packs first yielding object ids sorted by their position in the pack, with those at the beginning of the pack file coming first. /// Then follow loose objects sorted by their names. @@ -48,12 +49,6 @@ pub enum Ordering { PackAscendingOffsetThenLooseLexicographical, } -impl Default for Ordering { - fn default() -> Self { - Ordering::PackLexicographicalThenLooseLexicographical - } -} - /// An iterator over all, _possibly duplicate_, objects of an object store, which by default uses no extra memory but yields an /// order that is costly to traverse when querying object information or decoding them. /// diff --git a/vendor/gix-odb/src/store_impls/dynamic/mod.rs b/vendor/gix-odb/src/store_impls/dynamic/mod.rs index 5cf2a26ee..774bb61dc 100644 --- a/vendor/gix-odb/src/store_impls/dynamic/mod.rs +++ b/vendor/gix-odb/src/store_impls/dynamic/mod.rs @@ -28,23 +28,18 @@ where } /// Decide what happens when all indices are loaded. -#[derive(Clone, Copy)] +#[derive(Default, Clone, Copy)] pub enum RefreshMode { /// Check for new or changed pack indices (and pack data files) when the last known index is loaded. /// During runtime we will keep pack indices stable by never reusing them, however, there is the option for /// clearing internal caches which is likely to change pack ids and it will trigger unloading of packs as they are missing on disk. + #[default] AfterAllIndicesLoaded, /// Use this if you expect a lot of missing objects that shouldn't trigger refreshes even after all packs are loaded. /// This comes at the risk of not learning that the packs have changed in the mean time. Never, } -impl Default for RefreshMode { - fn default() -> Self { - RefreshMode::AfterAllIndicesLoaded - } -} - impl RefreshMode { /// Set this refresh mode to never refresh. pub fn never(&mut self) { @@ -94,7 +89,7 @@ pub mod structure { /// A record of a structural element of an object database. #[derive(Debug, Clone, PartialEq, Eq)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Record { /// A loose object database. LooseObjectDatabase { @@ -123,7 +118,7 @@ pub mod structure { } #[derive(Debug, Clone, PartialEq, Eq)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] /// Possible stats of pack indices. pub enum IndexState { /// The index is active in memory because a mapping exists. diff --git a/vendor/gix-odb/src/store_impls/dynamic/types.rs b/vendor/gix-odb/src/store_impls/dynamic/types.rs index 2bda0d7d3..df2365433 100644 --- a/vendor/gix-odb/src/store_impls/dynamic/types.rs +++ b/vendor/gix-odb/src/store_impls/dynamic/types.rs @@ -394,7 +394,7 @@ pub(crate) struct MutableIndexAndPack { /// A snapshot about resource usage. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Metrics { /// The total amount of handles which can be used to access object information. pub num_handles: usize, diff --git a/vendor/gix-odb/src/store_impls/dynamic/verify.rs b/vendor/gix-odb/src/store_impls/dynamic/verify.rs index 9a35cb5d7..d6291e834 100644 --- a/vendor/gix-odb/src/store_impls/dynamic/verify.rs +++ b/vendor/gix-odb/src/store_impls/dynamic/verify.rs @@ -44,7 +44,7 @@ pub mod integrity { } #[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] /// Integrity information about loose object databases pub struct LooseObjectStatistics { /// The path to the root directory of the loose objects database @@ -54,7 +54,7 @@ pub mod integrity { } #[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] /// Traversal statistics of packs governed by single indices or multi-pack indices. #[allow(missing_docs)] pub enum SingleOrMultiStatistics { @@ -64,7 +64,7 @@ pub mod integrity { /// Statistics gathered when traversing packs of various kinds of indices. #[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IndexStatistics { /// The path to the index or multi-pack index for which statics were gathered. pub path: PathBuf, @@ -109,7 +109,7 @@ pub mod integrity { impl super::Store { /// Check the integrity of all objects as per the given `options`. /// - /// Note that this will not not force loading all indices or packs permanently, as we will only use the momentarily loaded disk state. + /// Note that this will not force loading all indices or packs permanently, as we will only use the momentarily loaded disk state. /// This does, however, include all alternates. pub fn verify_integrity( &self, diff --git a/vendor/gix-odb/src/store_impls/loose/verify.rs b/vendor/gix-odb/src/store_impls/loose/verify.rs index 648e5764c..8ffbb7105 100644 --- a/vendor/gix-odb/src/store_impls/loose/verify.rs +++ b/vendor/gix-odb/src/store_impls/loose/verify.rs @@ -33,7 +33,7 @@ pub mod integrity { /// The outcome returned by [`verify_integrity()`][super::Store::verify_integrity()]. #[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)] - #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Statistics { /// The amount of loose objects we checked. pub num_objects: usize, diff --git a/vendor/gix-odb/src/store_impls/loose/write.rs b/vendor/gix-odb/src/store_impls/loose/write.rs index e87462e4c..912426bba 100644 --- a/vendor/gix-odb/src/store_impls/loose/write.rs +++ b/vendor/gix-odb/src/store_impls/loose/write.rs @@ -98,6 +98,16 @@ impl crate::traits::Write for Store { type CompressedTempfile = deflate::Write; +/// Access +impl Store { + /// Return the path to the object with `id`. + /// + /// Note that is may not exist yet. + pub fn object_path(&self, id: &gix_hash::oid) -> PathBuf { + loose::hash_path(id, self.path.clone()) + } +} + impl Store { fn dest(&self) -> Result, Error> { Ok(hash::Write::new( @@ -126,7 +136,36 @@ impl Store { } } let file = file.into_inner(); - file.persist(&object_path).map_err(|err| Error::Persist { + let res = file.persist(&object_path); + // On windows, we assume that such errors are due to its special filesystem semantics, + // on any other platform that would be a legitimate error though. + #[cfg(windows)] + if let Err(err) = &res { + if err.error.kind() == std::io::ErrorKind::PermissionDenied + || err.error.kind() == std::io::ErrorKind::AlreadyExists + { + return Ok(id); + } + } + #[cfg(unix)] + if let Ok(mut perm) = object_path.metadata().map(|m| m.permissions()) { + use std::os::unix::fs::PermissionsExt; + /// For now we assume the default with standard umask. This can be more sophisticated, + /// but we have the bare minimum. + fn comp_mode(_mode: u32) -> u32 { + 0o444 + } + let new_mode = comp_mode(perm.mode()); + if (perm.mode() ^ new_mode) & !0o170000 != 0 { + perm.set_mode(new_mode); + std::fs::set_permissions(&object_path, perm).map_err(|err| Error::Io { + source: err, + message: "Failed to set permission bits", + path: object_path.clone(), + })?; + } + } + res.map_err(|err| Error::Persist { source: err, target: object_path, })?; -- cgit v1.2.3