u-hurd-gix-index
authorVarious <see below>
Wed, 19 Jun 2024 05:49:55 +0000 (07:49 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Wed, 19 Jun 2024 05:51:49 +0000 (07:51 +0200)
commit 569caa0314599c93651d9116d00fde64b81d2ace
Author: Qiu Chaofan <qcf@ecnelises.com>
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 <josh@joshtriplett.org>
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 <samuel.thibault@ens-lyon.org>
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

Gbp-Pq: Topic vendor
Gbp-Pq: Name u-hurd-gix-index.patch

vendor/gix-index/src/fs.rs

index fad21cc0520f1c2273928b5dc83d6e35c9a1d109..493d4e11736fb85adfbaa845604d0aca2a24f6d9 100644 (file)
@@ -54,12 +54,21 @@ impl Metadata {
     pub fn modified(&self) -> Option<SystemTime> {
         #[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<SystemTime> {
         #[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)]