diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix-date | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-date')
-rw-r--r-- | vendor/gix-date/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-date/CHANGELOG.md | 223 | ||||
-rw-r--r-- | vendor/gix-date/Cargo.toml | 10 | ||||
-rw-r--r-- | vendor/gix-date/src/lib.rs | 16 | ||||
-rw-r--r-- | vendor/gix-date/src/parse.rs | 39 | ||||
-rw-r--r-- | vendor/gix-date/src/time/format.rs | 12 | ||||
-rw-r--r-- | vendor/gix-date/src/time/init.rs | 52 | ||||
-rw-r--r-- | vendor/gix-date/src/time/mod.rs | 9 | ||||
-rw-r--r-- | vendor/gix-date/src/time/write.rs | 89 |
9 files changed, 359 insertions, 93 deletions
diff --git a/vendor/gix-date/.cargo-checksum.json b/vendor/gix-date/.cargo-checksum.json index 7cfccb8c4..a729708c7 100644 --- a/vendor/gix-date/.cargo-checksum.json +++ b/vendor/gix-date/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"41db1421c587aab13fe9dd7db72ceab3342620c7cbd53280d1bcfac5392f51b4","Cargo.toml":"b0f0d961375b3026cd2c611f696dd2ddbda8dfefd2d6eb81830ae02bc06d985c","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/lib.rs":"9ac7d53257fc4f60f4cc996883ef1a1a34b24d6c58556f32b94042f5750a94d2","src/parse.rs":"69aede31dc073096393ff26b46d26cb7902ca3a3c918a61626ff02e1f2a04250","src/time/format.rs":"310fe8ec3a9adcada3ffa36c3ac753836eb4fe01ecd2e272f0ce69a746f078fb","src/time/init.rs":"2d0f13659ed20163bdce65adc9e277e562d9414a347313193d0eb4f1f1aaf50d","src/time/mod.rs":"0771b105bb5d78b1d68f7455b811dfe9ff8ec39bf0f80492804a199eb3be4676","src/time/write.rs":"be39421749c567d1320cc931f491cdaf38e6fcaaecbb1862165af1d5b0327832"},"package":"bc164145670e9130a60a21670d9b6f0f4f8de04e5dd256c51fa5a0340c625902"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"70d2de7417b5314dec6a1fb439cf7e381f96f5def028128369940f6a0cb4d625","Cargo.toml":"98d1aeed5ebe4f4c497048f32d4726b1e7ee0c1b55ef4cf1a642ab8a38a2f157","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/lib.rs":"bfd4d70adf03b9f1e8b3cd7e6520f73b649666ae5dde02989bc0df7f1239a58f","src/parse.rs":"23edb1a1cc67c6d55d8807c3837868cb386d75c3140baa6464cf3683265ee415","src/time/format.rs":"3258b597d42366717f25004952dd3b2baad513f280018dc6844b8dcbc16e522d","src/time/init.rs":"481329c7af236fd17fbb28a70c453180285a141e95e9f211a8fa8669c42a834d","src/time/mod.rs":"6e432419b90f754ce32f934cf1e57f302309b631d88129caf070b8a18c463ca1","src/time/write.rs":"35d89ae0f1bfcfe7b3544b4503f7ae938837c762b7b90d1c06816a0d5fb9d60d"},"package":"fc7df669639582dc7c02737642f76890b03b5544e141caba68a7d6b4eb551e0d"}
\ No newline at end of file diff --git a/vendor/gix-date/CHANGELOG.md b/vendor/gix-date/CHANGELOG.md index f399d207b..a79a3c908 100644 --- a/vendor/gix-date/CHANGELOG.md +++ b/vendor/gix-date/CHANGELOG.md @@ -5,6 +5,226 @@ 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.8.0 (2023-09-08) + +### Bug Fixes (BREAKING) + + - <csr-id-072ee32f693a31161cd6a843da6582d13efbb20b/> use `dyn` trait where possible. + This reduces compile time due to avoiding duplication. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 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 + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Prepare changelogs for release ([`375db06`](https://github.com/Byron/gitoxide/commit/375db06a8442378c3f7a922fae38e2a6694d9d04)) + - 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)) +</details> + +## 0.7.4 (2023-09-01) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 9 calendar days. + - 9 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### 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> + + * **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)) + - Thanks clippy ([`5044c3b`](https://github.com/Byron/gitoxide/commit/5044c3b87456cf58ebfbbd00f23c9ba671cb290c)) + - Merge branch 'gix-submodule' ([`363ee77`](https://github.com/Byron/gitoxide/commit/363ee77400805f473c9ad66eadad9214e7ab66f4)) +</details> + +## 0.7.3 (2023-08-22) + +<csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> + +### Chore + + - <csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> don't call crate 'WIP' in manifest anymore. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release over the course of 4 calendar days. + - 15 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-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)) + - Don't call crate 'WIP' in manifest anymore. ([`229bd48`](https://github.com/Byron/gitoxide/commit/229bd4899213f749a7cc124aa2b82a1368fba40f)) +</details> + +## 0.7.2 (2023-08-07) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 6 commits contributed to the release over the course of 4 calendar days. + - 15 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 1 unique issue was worked on: [#961](https://github.com/Byron/gitoxide/issues/961) + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **[#961](https://github.com/Byron/gitoxide/issues/961)** + - Add another fuzz-failure that doesn't fail ([`90ec770`](https://github.com/Byron/gitoxide/commit/90ec77057fa8a7d191c959e2f3a3c958270803eb)) + * **Uncategorized** + - 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)) + - Prepare changelogs prior to release of `gix-submodule` ([`f3c4311`](https://github.com/Byron/gitoxide/commit/f3c43110e8d5f16cf87e50821044d8b3edbae235)) + - 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)) + - Update `time` crate explicitly in Cargo.toml to latest version ([`e145a74`](https://github.com/Byron/gitoxide/commit/e145a7489dd5e1a7c3458428ecbd101e7b53536b)) +</details> + +## 0.7.1 (2023-07-22) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release over the course of 1 calendar day. + - 23 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-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)) + - Update license field following SPDX 2.1 license expression standard ([`9064ea3`](https://github.com/Byron/gitoxide/commit/9064ea31fae4dc59a56bdd3a06c0ddc990ee689e)) +</details> + +## 0.7.0 (2023-06-29) + +### New Features (BREAKING) + + - <csr-id-09fbfd2ac3100947c8ea96fdf6425032354aee1b/> support dates prior to the UNIX epoch. + This means such dates can now be parsed and represented. + We do this by switching the time representation from `u64` which + is used in `git` to `i64` which is used in `libgit2`. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 5 commits contributed to the release. + - 6 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-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)) + - Merge branch 'i64-times' ([`b407461`](https://github.com/Byron/gitoxide/commit/b407461d8991db67a5bdb2ab13f518f78a85ed40)) + - Adapt to changes in `gix-date` ([`fba45c6`](https://github.com/Byron/gitoxide/commit/fba45c68d57d5f73070a6949556a04187d42e427)) + - Support dates prior to the UNIX epoch. ([`09fbfd2`](https://github.com/Byron/gitoxide/commit/09fbfd2ac3100947c8ea96fdf6425032354aee1b)) +</details> + +## 0.6.0 (2023-06-22) + +<csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> + +### Chore + + - <csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> Add `clippy::redundant-closure-for-method-calls` lint + +### New Features (BREAKING) + + - <csr-id-4bc0ae1eb313ad83c793f397af9ca791b9b171e5/> Represent time as 64 bit integer. + That way, dates beyond 2038 are supported. + + Further, we rename `Time::seconds_since_unix_epoch` to `seconds`, and remove `seconds()` + as there now is a new type, `SecondsSinceUnixEpoch`. In the same vein, we rename + `Time::offset_in_seconds` to `offset` as it now has at type `OffsetInSeconds`. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 9 commits contributed to the release over the course of 11 calendar days. + - 15 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 + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **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)) + - `just fmt` ([`871dd0b`](https://github.com/Byron/gitoxide/commit/871dd0b977caf17159092a4739ba5408403cdb2c)) + - Merge branch 'corpus' ([`aa16c8c`](https://github.com/Byron/gitoxide/commit/aa16c8ce91452a3e3063cf1cf0240b6014c4743f)) + - Change MSRV to 1.65 ([`4f635fc`](https://github.com/Byron/gitoxide/commit/4f635fc4429350bae2582d25de86429969d28f30)) + - Merge branch 'help-874-redundant-closures' ([`fe59956`](https://github.com/Byron/gitoxide/commit/fe59956ad667303a923d7cfd9ffd72283df41d78)) + - Add `clippy::redundant-closure-for-method-calls` lint ([`bcad5c2`](https://github.com/Byron/gitoxide/commit/bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d)) + - Merge branch 'future-dates' ([`8d2e6a9`](https://github.com/Byron/gitoxide/commit/8d2e6a91ac92a033e9e3daad5cffa90263075536)) + - Represent time as 64 bit integer. ([`4bc0ae1`](https://github.com/Byron/gitoxide/commit/4bc0ae1eb313ad83c793f397af9ca791b9b171e5)) +</details> + ## 0.5.1 (2023-06-06) A maintenance release without user-facing changes. @@ -13,7 +233,7 @@ A maintenance release without user-facing changes. <csr-read-only-do-not-edit/> - - 4 commits contributed to the release over the course of 12 calendar days. + - 5 commits contributed to the release over the course of 12 calendar days. - 48 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 +245,7 @@ A maintenance release without user-facing changes. <details><summary>view details</summary> * **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 'main' into auto-clippy ([`3ef5c90`](https://github.com/Byron/gitoxide/commit/3ef5c90aebce23385815f1df674c1d28d58b4b0d)) - Merge branch 'blinxen/main' ([`9375cd7`](https://github.com/Byron/gitoxide/commit/9375cd75b01aa22a0e2eed6305fe45fabfd6c1ac)) diff --git a/vendor/gix-date/Cargo.toml b/vendor/gix-date/Cargo.toml index dff89ad1c..1bc9d817b 100644 --- a/vendor/gix-date/Cargo.toml +++ b/vendor/gix-date/Cargo.toml @@ -11,17 +11,17 @@ [package] edition = "2021" -rust-version = "1.64" +rust-version = "1.65" name = "gix-date" -version = "0.5.1" +version = "0.8.0" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = [ "src/**/*", "LICENSE-*", "CHANGELOG.md", ] -description = "A WIP crate of the gitoxide project parsing dates the way git does" -license = "MIT/Apache-2.0" +description = "A crate of the gitoxide project parsing dates the way git does" +license = "MIT OR Apache-2.0" repository = "https://github.com/Byron/gitoxide" [package.metadata.docs.rs] @@ -57,7 +57,7 @@ default-features = false version = "1.0.32" [dependencies.time] -version = "0.3.17" +version = "0.3.23" features = [ "local-offset", "formatting", diff --git a/vendor/gix-date/src/lib.rs b/vendor/gix-date/src/lib.rs index 736f5e598..d71283f45 100644 --- a/vendor/gix-date/src/lib.rs +++ b/vendor/gix-date/src/lib.rs @@ -22,9 +22,21 @@ pub use parse::function::parse; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Time { /// time in seconds since epoch. - pub seconds_since_unix_epoch: u32, + pub seconds: SecondsSinceUnixEpoch, /// time offset in seconds, may be negative to match the `sign` field. - pub offset_in_seconds: i32, + pub offset: OffsetInSeconds, /// the sign of `offset`, used to encode `-0000` which would otherwise loose sign information. pub sign: time::Sign, } + +/// The amount of seconds since unix epoch. +/// +/// Note that negative dates represent times before the unix epoch. +/// +/// ### Deviation +/// +/// `git` only supports dates *from* the UNIX epoch, whereas we chose to be more flexible at the expense of stopping time +/// a few million years before the heat-death of the universe. +pub type SecondsSinceUnixEpoch = i64; +/// time offset in seconds. +pub type OffsetInSeconds = i32; diff --git a/vendor/gix-date/src/parse.rs b/vendor/gix-date/src/parse.rs index 7038a80fb..323292cba 100644 --- a/vendor/gix-date/src/parse.rs +++ b/vendor/gix-date/src/parse.rs @@ -1,20 +1,18 @@ #[derive(thiserror::Error, Debug, Clone)] #[allow(missing_docs)] pub enum Error { - #[error("Cannot represent times before UNIX epoch at timestamp {timestamp}")] - TooEarly { timestamp: i64 }, #[error("Could not convert a duration into a date")] RelativeTimeConversion, #[error("Date string can not be parsed")] InvalidDateString { input: String }, - #[error("Dates past 2038 can not be represented.")] + #[error("The heat-death of the universe happens before this date")] InvalidDate(#[from] std::num::TryFromIntError), #[error("Current time is missing but required to handle relative dates.")] MissingCurrentTime, } pub(crate) mod function { - use std::{convert::TryInto, str::FromStr, time::SystemTime}; + use std::{str::FromStr, time::SystemTime}; use time::{format_description::well_known, Date, OffsetDateTime}; @@ -24,7 +22,7 @@ pub(crate) mod function { format::{DEFAULT, GITOXIDE, ISO8601, ISO8601_STRICT, SHORT}, Sign, }, - Time, + SecondsSinceUnixEpoch, Time, }; #[allow(missing_docs)] @@ -36,42 +34,33 @@ pub(crate) mod function { Ok(if let Ok(val) = Date::parse(input, SHORT) { let val = val.with_hms(0, 0, 0).expect("date is in range").assume_utc(); - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) } else if let Ok(val) = OffsetDateTime::parse(input, &well_known::Rfc2822) { - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) } else if let Ok(val) = OffsetDateTime::parse(input, ISO8601) { - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) } else if let Ok(val) = OffsetDateTime::parse(input, ISO8601_STRICT) { - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) } else if let Ok(val) = OffsetDateTime::parse(input, GITOXIDE) { - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) } else if let Ok(val) = OffsetDateTime::parse(input, DEFAULT) { - Time::new(val.unix_timestamp().try_into()?, val.offset().whole_seconds()) - } else if let Ok(val) = u32::from_str(input) { + Time::new(val.unix_timestamp(), val.offset().whole_seconds()) + } else if let Ok(val) = SecondsSinceUnixEpoch::from_str(input) { // Format::Unix Time::new(val, 0) } else if let Some(val) = parse_raw(input) { // Format::Raw val } else if let Some(time) = relative::parse(input, now).transpose()? { - Time::new(timestamp(time)?, time.offset().whole_seconds()) + Time::new(time.unix_timestamp(), time.offset().whole_seconds()) } else { return Err(Error::InvalidDateString { input: input.into() }); }) } - fn timestamp(date: OffsetDateTime) -> Result<u32, Error> { - let timestamp = date.unix_timestamp(); - if timestamp < 0 { - Err(Error::TooEarly { timestamp }) - } else { - Ok(timestamp.try_into()?) - } - } - fn parse_raw(input: &str) -> Option<Time> { let mut split = input.split_whitespace(); - let seconds_since_unix_epoch: u32 = split.next()?.parse().ok()?; + let seconds: SecondsSinceUnixEpoch = split.next()?.parse().ok()?; let offset = split.next()?; if offset.len() != 5 || split.next().is_some() { return None; @@ -88,8 +77,8 @@ pub(crate) mod function { offset_in_seconds *= -1; }; let time = Time { - seconds_since_unix_epoch, - offset_in_seconds, + seconds, + offset: offset_in_seconds, sign, }; Some(time) diff --git a/vendor/gix-date/src/time/format.rs b/vendor/gix-date/src/time/format.rs index 37cc12bd2..639ed58fa 100644 --- a/vendor/gix-date/src/time/format.rs +++ b/vendor/gix-date/src/time/format.rs @@ -68,12 +68,16 @@ impl Time { /// Use the [`format_description`](https://time-rs.github.io/book/api/format-description.html) macro to create and /// validate formats at compile time, courtesy of the [`time`] crate. pub fn format<'a>(&self, format: impl Into<Format<'a>>) -> String { - match format.into() { + self.format_inner(format.into()) + } + + fn format_inner(&self, format: Format<'_>) -> String { + match format { Format::Custom(format) => self .to_time() .format(&format) .expect("well-known format into memory never fails"), - Format::Unix => self.seconds_since_unix_epoch.to_string(), + Format::Unix => self.seconds.to_string(), Format::Raw => self.to_bstring().to_string(), } } @@ -81,8 +85,8 @@ impl Time { impl Time { fn to_time(self) -> time::OffsetDateTime { - time::OffsetDateTime::from_unix_timestamp(self.seconds_since_unix_epoch as i64) + time::OffsetDateTime::from_unix_timestamp(self.seconds) .expect("always valid unix time") - .to_offset(time::UtcOffset::from_whole_seconds(self.offset_in_seconds).expect("valid offset")) + .to_offset(time::UtcOffset::from_whole_seconds(self.offset).expect("valid offset")) } } diff --git a/vendor/gix-date/src/time/init.rs b/vendor/gix-date/src/time/init.rs index 7e4cdefc6..7df1e7aee 100644 --- a/vendor/gix-date/src/time/init.rs +++ b/vendor/gix-date/src/time/init.rs @@ -1,28 +1,26 @@ -use std::{convert::TryInto, ops::Sub}; +use std::ops::Sub; -use crate::{time::Sign, Time}; +use crate::{time::Sign, OffsetInSeconds, SecondsSinceUnixEpoch, Time}; /// Instantiation impl Time { /// Create a new instance from seconds and offset. - pub fn new(seconds_since_unix_epoch: u32, offset_in_seconds: i32) -> Self { + pub fn new(seconds: SecondsSinceUnixEpoch, offset: OffsetInSeconds) -> Self { Time { - seconds_since_unix_epoch, - offset_in_seconds, - sign: offset_in_seconds.into(), + seconds, + offset, + sign: offset.into(), } } /// Return the current time without figuring out a timezone offset pub fn now_utc() -> Self { - let seconds_since_unix_epoch = time::OffsetDateTime::now_utc() + let seconds = time::OffsetDateTime::now_utc() .sub(std::time::SystemTime::UNIX_EPOCH) - .whole_seconds() - .try_into() - .expect("this is not year 2038"); + .whole_seconds(); Self { - seconds_since_unix_epoch, - offset_in_seconds: 0, + seconds, + offset: 0, sign: Sign::Plus, } } @@ -30,18 +28,14 @@ impl Time { /// Return the current local time, or `None` if the local time wasn't available. pub fn now_local() -> Option<Self> { let now = time::OffsetDateTime::now_utc(); - let seconds_since_unix_epoch = now - .sub(std::time::SystemTime::UNIX_EPOCH) - .whole_seconds() - .try_into() - .expect("this is not year 2038"); + let seconds = now.sub(std::time::SystemTime::UNIX_EPOCH).whole_seconds(); // TODO: make this work without cfg(unsound_local_offset), see // https://github.com/time-rs/time/issues/293#issuecomment-909158529 - let offset_in_seconds = time::UtcOffset::local_offset_at(now).ok()?.whole_seconds(); + let offset = time::UtcOffset::local_offset_at(now).ok()?.whole_seconds(); Self { - seconds_since_unix_epoch, - offset_in_seconds, - sign: offset_in_seconds.into(), + seconds, + offset, + sign: offset.into(), } .into() } @@ -49,20 +43,16 @@ impl Time { /// Return the current local time, or the one at UTC if the local time wasn't available. pub fn now_local_or_utc() -> Self { let now = time::OffsetDateTime::now_utc(); - let seconds_since_unix_epoch = now - .sub(std::time::SystemTime::UNIX_EPOCH) - .whole_seconds() - .try_into() - .expect("this is not year 2038"); + let seconds = now.sub(std::time::SystemTime::UNIX_EPOCH).whole_seconds(); // TODO: make this work without cfg(unsound_local_offset), see // https://github.com/time-rs/time/issues/293#issuecomment-909158529 - let offset_in_seconds = time::UtcOffset::local_offset_at(now) - .map(|ofs| ofs.whole_seconds()) + let offset = time::UtcOffset::local_offset_at(now) + .map(time::UtcOffset::whole_seconds) .unwrap_or(0); Self { - seconds_since_unix_epoch, - offset_in_seconds, - sign: offset_in_seconds.into(), + seconds, + offset, + sign: offset.into(), } } } diff --git a/vendor/gix-date/src/time/mod.rs b/vendor/gix-date/src/time/mod.rs index 612a3cdef..22c4e42f0 100644 --- a/vendor/gix-date/src/time/mod.rs +++ b/vendor/gix-date/src/time/mod.rs @@ -6,11 +6,6 @@ impl Time { pub fn is_set(&self) -> bool { *self != Self::default() } - - /// Return the passed seconds since epoch since this signature was made. - pub fn seconds(&self) -> u32 { - self.seconds_since_unix_epoch - } } /// Indicates if a number is positive or negative for use in [`Time`]. @@ -58,8 +53,8 @@ mod impls { impl Default for Time { fn default() -> Self { Time { - seconds_since_unix_epoch: 0, - offset_in_seconds: 0, + seconds: 0, + offset: 0, sign: Sign::Plus, } } diff --git a/vendor/gix-date/src/time/write.rs b/vendor/gix-date/src/time/write.rs index d4d017bd3..cef8e4037 100644 --- a/vendor/gix-date/src/time/write.rs +++ b/vendor/gix-date/src/time/write.rs @@ -12,9 +12,9 @@ impl Time { } /// Serialize this instance to `out` in a format suitable for use in header fields of serialized git commits or tags. - pub fn write_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> { + pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> { let mut itoa = itoa::Buffer::new(); - out.write_all(itoa.format(self.seconds_since_unix_epoch).as_bytes())?; + out.write_all(itoa.format(self.seconds).as_bytes())?; out.write_all(b" ")?; out.write_all(match self.sign { Sign::Plus => b"+", @@ -24,7 +24,7 @@ impl Time { const ZERO: &[u8; 1] = b"0"; const SECONDS_PER_HOUR: i32 = 60 * 60; - let offset = self.offset_in_seconds.abs(); + let offset = self.offset.abs(); let hours = offset / SECONDS_PER_HOUR; assert!(hours < 25, "offset is more than a day: {hours}"); let minutes = (offset - (hours * SECONDS_PER_HOUR)) / 60; @@ -40,30 +40,85 @@ impl Time { out.write_all(itoa.format(minutes).as_bytes()).map(|_| ()) } - /// Computes the number of bytes necessary to render this time. + /// Computes the number of bytes necessary to write it using [`Time::write_to()`]. pub fn size(&self) -> usize { - // TODO: this is not year 2038 safeā¦but we also can't parse larger numbers (or represent them) anyway. It's a trap nonetheless - // that can be fixed by increasing the size to usize. - (if self.seconds_since_unix_epoch >= 1_000_000_000 { + (if self.seconds >= 1_000_000_000_000_000_000 { + 19 + } else if self.seconds >= 100_000_000_000_000_000 { + 18 + } else if self.seconds >= 10_000_000_000_000_000 { + 17 + } else if self.seconds >= 1_000_000_000_000_000 { + 16 + } else if self.seconds >= 100_000_000_000_000 { + 15 + } else if self.seconds >= 10_000_000_000_000 { + 14 + } else if self.seconds >= 1_000_000_000_000 { + 13 + } else if self.seconds >= 100_000_000_000 { + 12 + } else if self.seconds >= 10_000_000_000 { + 11 + } else if self.seconds >= 1_000_000_000 { 10 - } else if self.seconds_since_unix_epoch >= 100_000_000 { + } else if self.seconds >= 100_000_000 { 9 - } else if self.seconds_since_unix_epoch >= 10_000_000 { + } else if self.seconds >= 10_000_000 { 8 - } else if self.seconds_since_unix_epoch >= 1_000_000 { + } else if self.seconds >= 1_000_000 { 7 - } else if self.seconds_since_unix_epoch >= 100_000 { + } else if self.seconds >= 100_000 { 6 - } else if self.seconds_since_unix_epoch >= 10_000 { + } else if self.seconds >= 10_000 { 5 - } else if self.seconds_since_unix_epoch >= 1_000 { + } else if self.seconds >= 1_000 { 4 - } else if self.seconds_since_unix_epoch >= 100 { + } else if self.seconds >= 100 { 3 - } else if self.seconds_since_unix_epoch >= 10 { + } else if self.seconds >= 10 { 2 - } else { + } else if self.seconds >= 0 { 1 - }) + 2 /*space + sign*/ + 2 /*hours*/ + 2 /*minutes*/ + // from here, it's sign + num-digits characters + } else if self.seconds >= -10 { + 2 + } else if self.seconds >= -100 { + 3 + } else if self.seconds >= -1_000 { + 4 + } else if self.seconds >= -10_000 { + 5 + } else if self.seconds >= -100_000 { + 6 + } else if self.seconds >= -1_000_000 { + 7 + } else if self.seconds >= -10_000_000 { + 8 + } else if self.seconds >= -100_000_000 { + 9 + } else if self.seconds >= -1_000_000_000 { + 10 + } else if self.seconds >= -10_000_000_000 { + 11 + } else if self.seconds >= -100_000_000_000 { + 12 + } else if self.seconds >= -1_000_000_000_000 { + 13 + } else if self.seconds >= -10_000_000_000_000 { + 14 + } else if self.seconds >= -100_000_000_000_000 { + 15 + } else if self.seconds >= -1_000_000_000_000_000 { + 16 + } else if self.seconds >= -10_000_000_000_000_000 { + 17 + } else if self.seconds >= -100_000_000_000_000_000 { + 18 + } else if self.seconds >= -1_000_000_000_000_000_000 { + 19 + } else { + 20 + }) + 2 /*space + offset sign*/ + 2 /*offset hours*/ + 2 /*offset minutes*/ } } |