Store mtime in nanoseconds so a same-second rewrite is re-hashed (closes #12)
check / check (push) Canceled after 0s

scan recorded mtime in whole seconds, so a file rewritten in place at
the same size within the same second as its recorded mtime was classed
unchanged and kept its old hashes. The walk, a file given as an operand,
and the content phase's recheck now all use ModTime().UnixNano(); the
change rule itself is unchanged. The column stays INTEGER and
PRAGMA user_version stays 1, per the owner's ruling. A database written
by an earlier build holds seconds, so its files count as changed once,
at the next scan that covers them. README states the new resolution.

Model: opus-5-5
This commit is contained in:
2026-10-07 21:21:38 +00:00
parent 0064eba542
commit afb404b1c1
4 changed files with 59 additions and 7 deletions
+3 -3
View File
@@ -807,7 +807,7 @@ func unchangedFile(r scanRec) (fileRec, bool, error) {
}
if !fi.Mode().IsRegular() || fi.Size() != r.size ||
fi.ModTime().Unix() > r.mtime {
fi.ModTime().UnixNano() > r.mtime {
return fileRec{}, false, nil
}
@@ -966,7 +966,7 @@ func seedRoot(ctx context.Context, root string,
sendEvent(ctx, events, walkEvent{rec: fileRec{
path: root,
size: fi.Size(),
mtime: fi.ModTime().Unix(),
mtime: fi.ModTime().UnixNano(),
dev: dev,
ino: ino,
}})
@@ -1124,7 +1124,7 @@ func emitFile(ctx context.Context, p string, e fs.DirEntry,
sendEvent(ctx, events, walkEvent{rec: fileRec{
path: p,
size: info.Size(),
mtime: info.ModTime().Unix(),
mtime: info.ModTime().UnixNano(),
dev: dev,
ino: ino,
}})