chore: slightly optimise rename detection (ref #10777) (#10819)

Only run rename detection for new files. This skips an expensive check
for all updates to existing files. The tradeoff is that we no longer
immediately detect renames on top of another file as a rename -- this
may instead become a copy+delete operation on the destination.

---------

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-07-25 07:46:56 +00:00
committed by GitHub
parent b15ff42d52
commit ec35a95318
4 changed files with 33 additions and 14 deletions
+4 -1
View File
@@ -146,6 +146,8 @@ type FileInfo struct {
Deleted bool
NoPermissions bool
New bool // set by the scanner when the file newly appeared on disk; no db / wire representation
truncated bool // was created from a truncated file info without blocks
}
@@ -233,7 +235,8 @@ func (f *FileInfo) LogAttr() slog.Attr {
case FileInfoTypeFile:
kind = "file"
if !f.Deleted {
attrs = append(attrs,
attrs = append(
attrs,
slog.Any("modified", f.ModTime()),
slog.String("permissions", fmt.Sprintf("0%03o", f.Permissions)),
slog.Int64("size", f.Size),