Skip to content

Commit f1c87a7

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

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

crates/etc-merge/src/lib.rs

Lines changed: 3 additions & 9 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
}
@@ -97,8 +93,6 @@ fn collect_all_files(root: &Directory<CustomMetadata>, current_path: PathBuf) ->
9793

9894
if let Inode::Directory(dir) = inode {
9995
collect(dir, current_path.clone(), files);
100-
} else {
101-
// files.push(current_path.clone());
10296
}
10397

10498
current_path.pop();
@@ -183,7 +177,7 @@ fn get_modifications(
183177
Inode::Directory(curr_dir) => {
184178
match pristine.get_directory(path) {
185179
Ok(old_dir) => {
186-
if !stat_eq(&curr_dir.stat, &old_dir.stat) {
180+
if !stat_eq_ignore_mtime(&curr_dir.stat, &old_dir.stat) {
187181
// Directory permissions/owner modified
188182
diff.modified.push(current_path.clone());
189183
}
@@ -215,7 +209,7 @@ fn get_modifications(
215209
};
216210

217211
if old_meta.content_hash != current_meta.content_hash
218-
|| !stat_eq(&old_leaf.stat, &leaf.stat)
212+
|| !stat_eq_ignore_mtime(&old_leaf.stat, &leaf.stat)
219213
{
220214
// File modified in some way
221215
diff.modified.push(current_path.clone());

0 commit comments

Comments
 (0)