Skip to content

Commit

Permalink
fix: re-enable local-time support for all binaries
Browse files Browse the repository at this point in the history
The `time` improved the way one can opt-in to potential unsoundness
in their local time support, forcing the application to make that
decision at runtime.
  • Loading branch information
Byron committed Feb 17, 2023
1 parent fe58a79 commit 73372d0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ anyhow = "1.0.42"
gitoxide-core = { version = "^0.24.0", path = "gitoxide-core" }
gix-features = { version = "^0.26.4", path = "gix-features" }
gix = { version = "^0.36.0", path = "gix", default-features = false }
time = "0.3.19"

clap = { version = "4.1.1", features = ["derive", "cargo"] }
prodash = { version = "23.0", optional = true, default-features = false }
Expand Down
3 changes: 1 addition & 2 deletions src/ein.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![deny(rust_2018_idioms)]
#![forbid(unsafe_code)]
#![deny(rust_2018_idioms, unsafe_code)]

mod porcelain;
mod shared;
Expand Down
3 changes: 1 addition & 2 deletions src/gix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![deny(rust_2018_idioms)]
#![forbid(unsafe_code)]
#![deny(unsafe_code, rust_2018_idioms)]

mod plumbing;
mod shared;
Expand Down
5 changes: 5 additions & 0 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pub mod async_util {

pub fn main() -> Result<()> {
let args: Args = Args::parse_from(gix::env::args_os());
#[allow(unsafe_code)]
unsafe {
// SAFETY: we don't manipulate the environment from any thread
time::util::local_offset::set_soundness(time::util::local_offset::Soundness::Unsound);
}
let thread_limit = args.threads;
let verbose = args.verbose;
let format = args.format;
Expand Down
5 changes: 5 additions & 0 deletions src/porcelain/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ use crate::{

pub fn main() -> Result<()> {
let args: Args = Args::parse_from(gix::env::args_os());
#[allow(unsafe_code)]
unsafe {
// SAFETY: we don't manipulate the environment from any thread
time::util::local_offset::set_soundness(time::util::local_offset::Soundness::Unsound);
}
let should_interrupt = Arc::new(AtomicBool::new(false));
gix::interrupt::init_handler({
let should_interrupt = Arc::clone(&should_interrupt);
Expand Down

0 comments on commit 73372d0

Please sign in to comment.