diff options
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2022-11-16 12:43:31 +0000 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2022-11-25 20:58:41 -0330 |
commit | b2fc83657dc2a893e384110e73778988f975cb5a (patch) | |
tree | d4a27de49743e27e1505fc374d95f338dc26bda0 | |
parent | 1557e28b8b89b1f2630a43abadd1908c9739a86a (diff) |
Bump chrono from 0.4.22 to 0.4.23
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.22 to 0.4.23.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.22...v0.4.23)
---
updated-dependencies:
- dependency-name: chrono
dependency-type: direct:production
update-type: version-update:semver-patch
...
Co-authored-by: Tim Oram <dev@mitmaro.ca>
Signed-off-by: dependabot[bot] <support@github.com>
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | src/core/Cargo.toml | 2 | ||||
-rw-r--r-- | src/git/Cargo.toml | 2 | ||||
-rw-r--r-- | src/git/src/commit.rs | 8 | ||||
-rw-r--r-- | src/git/src/testutil/build_commit.rs | 7 |
5 files changed, 14 insertions, 9 deletions
@@ -64,9 +64,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index cb1287b..a5b9e56 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -40,5 +40,5 @@ serial_test = "0.9.0" girt-view = {version = "2.2.0", path = "../../src/view", features = ["testutils"]} [build-dependencies] -chrono = "0.4.22" +chrono = "0.4.23" rustc_version = "0.4.0" diff --git a/src/git/Cargo.toml b/src/git/Cargo.toml index 790ab0c..e49a9e2 100644 --- a/src/git/Cargo.toml +++ b/src/git/Cargo.toml @@ -15,7 +15,7 @@ readme = "README.md" name = "git" [dependencies] -chrono = "0.4.22" +chrono = "0.4.23" lazy_static = "1.4.0" parking_lot = "0.12.1" tempfile = "3.3.0" diff --git a/src/git/src/commit.rs b/src/git/src/commit.rs index a88329a..6361f98 100644 --- a/src/git/src/commit.rs +++ b/src/git/src/commit.rs @@ -74,10 +74,14 @@ impl Commit { fn new(commit: &git2::Commit<'_>, reference: Option<&git2::Reference<'_>>) -> Self { let author = User::new(commit.author().name(), commit.author().email()); - let authored_date = Local.timestamp(commit.author().when().seconds(), 0); let message = commit.message().map(String::from); let summary = commit.summary().map(String::from); - let committed_date = Local.timestamp(commit.time().seconds(), 0); + // this should never panic, since msecs is always zero + let committed_date = Local.timestamp_opt(commit.time().seconds(), 0).unwrap(); + let authored_date = Local + .timestamp_opt(commit.author().when().seconds(), 0) + .single() + .unwrap_or(committed_date); let try_committer = User::new(commit.committer().name(), commit.committer().email()); let committer = (try_committer.is_some() && try_committer != author).then_some(try_committer); diff --git a/src/git/src/testutil/build_commit.rs b/src/git/src/testutil/build_commit.rs index 1637cd0..c1513a0 100644 --- a/src/git/src/testutil/build_commit.rs +++ b/src/git/src/testutil/build_commit.rs @@ -13,6 +13,7 @@ impl CommitBuilder { /// to a committed date of Jan 1, 2021 UTC. All other fields are `None`. #[inline] #[must_use] + #[allow(clippy::missing_panics_doc)] pub fn new(hash: &str) -> Self { Self { commit: Commit { @@ -20,7 +21,7 @@ impl CommitBuilder { reference: None, author: User::new(None, None), authored_date: None, - committed_date: Local.timestamp(JAN_2021_EPOCH, 0), + committed_date: Local.timestamp_opt(JAN_2021_EPOCH, 0).unwrap(), committer: None, message: None, summary: None, @@ -58,7 +59,7 @@ impl CommitBuilder { #[inline] #[must_use] pub fn authored_time(mut self, time: i64) -> Self { - self.commit.authored_date = Some(Local.timestamp(time, 0)); + self.commit.authored_date = Some(Local.timestamp_opt(time, 0).unwrap()); self } @@ -75,7 +76,7 @@ impl CommitBuilder { #[inline] #[must_use] pub fn commit_time(mut self, time: i64) -> Self { - self.commit.committed_date = Local.timestamp(time, 0); + self.commit.committed_date = Local.timestamp_opt(time, 0).unwrap(); self } |