Skip to content

Commit 4fe8e38

Browse files
authored
Merge pull request GitoxideLabs#2428 from weihanglo/fix-loongarch64-musl-stat
fix(gix-index): handle loongarch64-musl stat struct field names
2 parents 28fbeb8 + 7e25c34 commit 4fe8e38

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

gix-index/src/fs.rs

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,30 @@ impl Metadata {
5454
pub fn modified(&self) -> Option<SystemTime> {
5555
#[cfg(not(windows))]
5656
{
57-
#[cfg(not(any(target_os = "aix", target_os = "hurd")))]
57+
#[cfg(not(any(
58+
target_os = "aix",
59+
target_os = "hurd",
60+
all(target_arch = "loongarch64", target_env = "musl")
61+
)))]
5862
let seconds = self.0.st_mtime;
59-
#[cfg(any(target_os = "aix", target_os = "hurd"))]
63+
#[cfg(any(
64+
target_os = "aix",
65+
target_os = "hurd",
66+
all(target_arch = "loongarch64", target_env = "musl")
67+
))]
6068
let seconds = self.0.st_mtim.tv_sec;
6169

62-
#[cfg(not(any(target_os = "aix", target_os = "hurd")))]
70+
#[cfg(not(any(
71+
target_os = "aix",
72+
target_os = "hurd",
73+
all(target_arch = "loongarch64", target_env = "musl")
74+
)))]
6375
let nanoseconds = self.0.st_mtime_nsec;
64-
#[cfg(any(target_os = "aix", target_os = "hurd"))]
76+
#[cfg(any(
77+
target_os = "aix",
78+
target_os = "hurd",
79+
all(target_arch = "loongarch64", target_env = "musl")
80+
))]
6581
let nanoseconds = self.0.st_mtim.tv_nsec;
6682

6783
// All operating systems treat the seconds as offset from unix epoch, hence it must
@@ -81,14 +97,30 @@ impl Metadata {
8197
pub fn created(&self) -> Option<SystemTime> {
8298
#[cfg(not(windows))]
8399
{
84-
#[cfg(not(any(target_os = "aix", target_os = "hurd")))]
100+
#[cfg(not(any(
101+
target_os = "aix",
102+
target_os = "hurd",
103+
all(target_arch = "loongarch64", target_env = "musl")
104+
)))]
85105
let seconds = self.0.st_ctime;
86-
#[cfg(any(target_os = "aix", target_os = "hurd"))]
106+
#[cfg(any(
107+
target_os = "aix",
108+
target_os = "hurd",
109+
all(target_arch = "loongarch64", target_env = "musl")
110+
))]
87111
let seconds = self.0.st_ctim.tv_sec;
88112

89-
#[cfg(not(any(target_os = "aix", target_os = "hurd")))]
113+
#[cfg(not(any(
114+
target_os = "aix",
115+
target_os = "hurd",
116+
all(target_arch = "loongarch64", target_env = "musl")
117+
)))]
90118
let nanoseconds = self.0.st_ctime_nsec;
91-
#[cfg(any(target_os = "aix", target_os = "hurd"))]
119+
#[cfg(any(
120+
target_os = "aix",
121+
target_os = "hurd",
122+
all(target_arch = "loongarch64", target_env = "musl")
123+
))]
92124
let nanoseconds = self.0.st_ctim.tv_nsec;
93125

94126
// All operating systems treat the seconds as offset from unix epoch, hence it must

0 commit comments

Comments
 (0)