Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions localfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ func (fs *LocalFS) applyDirMetadata(n NodeDirectory) error {
if err := fs.SetDirPermissions(n); err != nil {
return err
}
if n.MTime == time.Unix(0, 0) {
// Use Equal() rather than ==, which also compares the monotonic reading
// and the location and would miss an epoch mtime in a different location.
if n.MTime.Equal(time.Unix(0, 0)) {
return nil
}
return r.Chtimes(n.Name, n.MTime, n.MTime)
Expand Down Expand Up @@ -225,7 +227,7 @@ func (fs *LocalFS) CreateFile(n NodeFile) error {
return err
}

if n.MTime == time.Unix(0, 0) {
if n.MTime.Equal(time.Unix(0, 0)) {
return nil
}
return r.Chtimes(n.Name, n.MTime, n.MTime)
Expand Down
2 changes: 1 addition & 1 deletion localfs_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (fs *LocalFS) CreateDevice(n NodeDevice) error {
return fmt.Errorf("chmod %s: %w", n.Name, err)
}
}
if n.MTime == time.Unix(0, 0) {
if n.MTime.Equal(time.Unix(0, 0)) {
return nil
}
return r.Chtimes(n.Name, n.MTime, n.MTime)
Expand Down