fix: populate ctime from actual filesystem stats instead of mtime fallback
All checks were successful
check / check (pull_request) Successful in 2m27s
All checks were successful
check / check (pull_request) Successful in 2m27s
Replace the mtime fallback for ctime in the scanner with platform-specific implementations that extract the real ctime from syscall.Stat_t: - macOS/Darwin: uses Birthtimespec (file birth/creation time) - Linux: uses Ctim (inode change time) - Falls back to mtime when syscall stats are unavailable (e.g. afero.MemMapFs) Also: - Document platform-specific ctime semantics in README - Document ctime restore limitations (cannot be set on either platform) - Add ctime field documentation to File model - Update README files table schema to match actual schema (adds ctime, source_path, link_target columns) - Add comprehensive tests for fileCTime on real files and mock FileInfo closes #13
This commit is contained in:
@@ -728,7 +728,7 @@ func (s *Scanner) checkFileInMemory(path string, info os.FileInfo, knownFiles ma
|
||||
Path: types.FilePath(path),
|
||||
SourcePath: types.SourcePath(s.currentSourcePath), // Store source directory for restore path stripping
|
||||
MTime: info.ModTime(),
|
||||
CTime: info.ModTime(), // afero doesn't provide ctime
|
||||
CTime: fileCTime(info), // platform-specific: birth time on macOS, inode change time on Linux
|
||||
Size: info.Size(),
|
||||
Mode: uint32(info.Mode()),
|
||||
UID: uid,
|
||||
|
||||
Reference in New Issue
Block a user