Skip to content

Commit b2f05a1

Browse files
etc-merge: Ignore mtime while comparing stat
Signed-off-by: Johan-Liebert1 <[email protected]>
1 parent d527926 commit b2f05a1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

crates/etc-merge/src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl From<(&cap_std::fs::Metadata, Xattrs)> for MyStat {
5252
}
5353
}
5454

55-
fn stat_eq(this: &Stat, other: &Stat) -> bool {
55+
fn stat_eq_ignore_mtime(this: &Stat, other: &Stat) -> bool {
5656
if this.st_uid != other.st_uid {
5757
return false;
5858
}
@@ -65,10 +65,6 @@ fn stat_eq(this: &Stat, other: &Stat) -> bool {
6565
return false;
6666
}
6767

68-
if this.st_mtim_sec != other.st_mtim_sec {
69-
return false;
70-
}
71-
7268
if this.xattrs != other.xattrs {
7369
return false;
7470
}
@@ -183,7 +179,7 @@ fn get_modifications(
183179
Inode::Directory(curr_dir) => {
184180
match pristine.get_directory(path) {
185181
Ok(old_dir) => {
186-
if !stat_eq(&curr_dir.stat, &old_dir.stat) {
182+
if !stat_eq_ignore_mtime(&curr_dir.stat, &old_dir.stat) {
187183
// Directory permissions/owner modified
188184
diff.modified.push(current_path.clone());
189185
}
@@ -215,7 +211,7 @@ fn get_modifications(
215211
};
216212

217213
if old_meta.content_hash != current_meta.content_hash
218-
|| !stat_eq(&old_leaf.stat, &leaf.stat)
214+
|| !stat_eq_ignore_mtime(&old_leaf.stat, &leaf.stat)
219215
{
220216
// File modified in some way
221217
diff.modified.push(current_path.clone());

0 commit comments

Comments
 (0)