Hi,
I was comparing backed up and restored file lists and I noticed that directory mtime is always changed from how it was on the source.
mtime gets changed to be the same as the newest file mtime in the directory.
I believe that happens in this code which runs at restore time:
snapshot/snapshotfs/repofs.go
// EntryFromDirEntry returns a filesystem entry based on the directory entry.
func EntryFromDirEntry(r repo.Repository, md *snapshot.DirEntry) fs.Entry {
re := repositoryEntry{
metadata: md,
repo: r,
}
switch md.Type {
case snapshot.EntryTypeDirectory:
if md.DirSummary != nil {
md.FileSize = md.DirSummary.TotalFileSize
md.ModTime = md.DirSummary.MaxModTime <====== Possible reason
}
return fs.Directory(&repositoryDirectory{re, md.DirSummary})
If I print md.ModTime before the marked line it is correct but then it gets changed to md.DirSummary.MaxModTime which matches what is getting restored.
This affects “ls -l” and the restore.
Is this how restore works by design or it is a side effect for something that is needed at backup time when comparing files for incremental?
Regards,
David