From: Various Date: Wed, 19 Jun 2024 07:49:55 +0200 Subject: u-hurd-gix-index commit 569caa0314599c93651d9116d00fde64b81d2ace Author: Qiu Chaofan Date: Wed Dec 20 13:11:52 2023 +0800 fix: use correct fields for ctime and mtime on AIX On AIX, ctime and mtime are structs containing seconds and nanoseconds. commit 6fc27ee8f5ae7ce9fe7e6d07c5c31719cb6b7b1b Author: Josh Triplett Date: Sat Jan 13 16:54:33 2024 -0800 Avoid using #[cfg] on multiple individual function arguments Attaching #[cfg] to individual arguments makes it look like the function has five conditionally present arguments, and doesn't make it immediately apparent that the first two are for the first argument and the last three are for the second argument. Split them into separate `let` statements for clarity. In the process, factor out the common `.try_into().ok()?` from each. commit daf3844c8f5ce6d0812e35677b1a46d568e226db Author: Samuel Thibault Date: Sun May 26 21:13:40 2024 +0200 hurd: fix accessing st_[mc]time GNU/Hurd uses a st_[mc]tim timespec, like aix --- vendor/gix-index/src/fs.rs | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/vendor/gix-index/src/fs.rs b/vendor/gix-index/src/fs.rs index fad21cc..493d4e1 100644 --- a/vendor/gix-index/src/fs.rs +++ b/vendor/gix-index/src/fs.rs @@ -54,12 +54,21 @@ impl Metadata { pub fn modified(&self) -> Option { #[cfg(not(windows))] { + #[cfg(not(any(target_os = "aix", target_os = "hurd")))] + let seconds = self.0.st_mtime; + #[cfg(any(target_os = "aix", target_os = "hurd"))] + let seconds = self.0.st_mtim.tv_sec; + + #[cfg(not(any(target_os = "netbsd", target_os = "aix", target_os = "hurd")))] + let nanoseconds = self.0.st_mtime_nsec; + #[cfg(target_os = "netbsd")] + let nanoseconds = self.0.st_mtimensec; + #[cfg(any(target_os = "aix", target_os = "hurd"))] + let nanoseconds = self.0.st_mtim.tv_nsec; + Some(system_time_from_secs_nanos( - self.0.st_mtime.try_into().ok()?, - #[cfg(not(target_os = "netbsd"))] - self.0.st_mtime_nsec.try_into().ok()?, - #[cfg(target_os = "netbsd")] - self.0.st_mtimensec.try_into().ok()?, + seconds.try_into().ok()?, + nanoseconds.try_into().ok()?, )) } #[cfg(windows)] @@ -73,12 +82,21 @@ impl Metadata { pub fn created(&self) -> Option { #[cfg(not(windows))] { + #[cfg(not(any(target_os = "aix", target_os = "hurd")))] + let seconds = self.0.st_ctime; + #[cfg(any(target_os = "aix", target_os = "hurd"))] + let seconds = self.0.st_ctim.tv_sec; + + #[cfg(not(any(target_os = "netbsd", target_os = "aix", target_os = "hurd")))] + let nanoseconds = self.0.st_ctime_nsec; + #[cfg(target_os = "netbsd")] + let nanoseconds = self.0.st_ctimensec; + #[cfg(any(target_os = "aix", target_os = "hurd"))] + let nanoseconds = self.0.st_ctim.tv_nsec; + Some(system_time_from_secs_nanos( - self.0.st_ctime.try_into().ok()?, - #[cfg(not(target_os = "netbsd"))] - self.0.st_ctime_nsec.try_into().ok()?, - #[cfg(target_os = "netbsd")] - self.0.st_ctimensec.try_into().ok()?, + seconds.try_into().ok()?, + nanoseconds.try_into().ok()?, )) } #[cfg(windows)]