summaryrefslogtreecommitdiffstats
path: root/debian/patches/vendor/u-hurd-gix-index.patch
blob: 8341c15c6d5db157257f6c10bb68d7b7184b8e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From: Various <see below>
Date: Wed, 19 Jun 2024 07:49:55 +0200
Subject: u-hurd-gix-index

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
---
 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<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)]