Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gix-date: switch from time to jiff #1474

Merged
merged 6 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ jobs:
- ubuntu-latest
runs-on: ${{ matrix.os }}
env:
# dictated by `firefox` to support the `helix` editor, but now driven by the `time` crate. IMPORTANT: adjust etc/msrv-badge.svg as well
rust_version: 1.67.0
# dictated by `firefox` to support the `helix` editor, but now probably effectively be controlled by `jiff`, which also aligns with `regex`.
# IMPORTANT: adjust etc/msrv-badge.svg as well
rust_version: 1.70.0
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
Expand Down
67 changes: 45 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,12 @@ http-client-reqwest = ["gix/blocking-http-transport-reqwest-rust-tls"]
## Use async client networking.
gitoxide-core-async-client = ["gitoxide-core/async-client", "futures-lite"]


[dependencies]
anyhow = "1.0.42"

gitoxide-core = { version = "^0.39.1", path = "gitoxide-core" }
gix-features = { version = "^0.38.2", path = "gix-features" }
gix = { version = "^0.64.0", path = "gix", default-features = false }
time = "0.3.23"

clap = { version = "4.1.1", features = ["derive", "cargo"] }
clap_complete = "4.4.3"
Expand Down
22 changes: 21 additions & 1 deletion etc/msrv-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gix-actor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ doctest = false
serde = ["dep:serde", "bstr/serde", "gix-date/serde"]

[dependencies]
gix-date = { version = "^0.8.7", path = "../gix-date" }
gix-date = { version = "^0.9.0", path = "../gix-date" }
gix-utils = { version = "^0.1.11", path = "../gix-utils" }

thiserror = "1.0.38"
Expand Down
8 changes: 4 additions & 4 deletions gix-archive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ tar = ["dep:tar", "dep:gix-path"]
tar_gz = ["tar", "dep:flate2"]

## Enable the `zip` archive format.
zip = ["dep:zip", "dep:time"]
zip = ["dep:zip"]


[dependencies]
gix-worktree-stream = { version = "^0.13.1", path = "../gix-worktree-stream" }
gix-object = { version = "^0.42.3", path = "../gix-object" }
gix-path = { version = "^0.10.9", path = "../gix-path", optional = true }
gix-date = { version = "^0.8.7", path = "../gix-date" }
gix-date = { version = "^0.9.0", path = "../gix-date" }

flate2 = { version = "1.0.26", optional = true }
zip = { version = "2.1.0", optional = true, default-features = false, features = ["deflate", "time"] }
time = { version = "0.3.23", optional = true, default-features = false, features = ["std"] }
zip = { version = "2.1.0", optional = true, default-features = false, features = ["deflate"] }
jiff = { version = "0.1.2", default-features = false, features = ["std"] }

thiserror = "1.0.26"
bstr = { version = "1.5.0", default-features = false }
Expand Down
18 changes: 15 additions & 3 deletions gix-archive/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,22 @@ where
{
let mut ar = zip::write::ZipWriter::new(out);
let mut buf = Vec::new();
let mtime = time::OffsetDateTime::from_unix_timestamp(opts.modification_time)
let zdt = jiff::Timestamp::from_second(opts.modification_time)
.map_err(|err| Error::InvalidModificationTime(Box::new(err)))?
.try_into()
.map_err(|err| Error::InvalidModificationTime(Box::new(err)))?;
.to_zoned(jiff::tz::TimeZone::UTC);
let mtime = zip::DateTime::from_date_and_time(
zdt.year()
.try_into()
.map_err(|err| Error::InvalidModificationTime(Box::new(err)))?,
// These are all OK because month, day, hour, minute and second
// are always positive.
zdt.month().try_into().expect("non-negative"),
zdt.day().try_into().expect("non-negative"),
zdt.hour().try_into().expect("non-negative"),
zdt.minute().try_into().expect("non-negative"),
zdt.second().try_into().expect("non-negative"),
)
.map_err(|err| Error::InvalidModificationTime(Box::new(err)))?;
while let Some(entry) = next_entry(stream)? {
append_zip_entry(
&mut ar,
Expand Down
Loading
Loading