diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 21:27:22 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 21:27:22 +0200 |
| commit | aca389f0e63713b890214cad950ac3aee7e6aaf4 (patch) | |
| tree | bb4dab94ca594edb339ab8fd1743d583efe3d59c /internal/plan/chain.go | |
| parent | 3bfafbc8664a2a1ba8efc3f64376ff63c3dc11b9 (diff) | |
| download | krino-aca389f0e63713b890214cad950ac3aee7e6aaf4.tar.gz krino-aca389f0e63713b890214cad950ac3aee7e6aaf4.zip | |
plan 9: overwrite never trashes a directory or another scanned file
Diffstat (limited to 'internal/plan/chain.go')
| -rw-r--r-- | internal/plan/chain.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/plan/chain.go b/internal/plan/chain.go index d4d07da..793e0e1 100644 --- a/internal/plan/chain.go +++ b/internal/plan/chain.go @@ -68,6 +68,14 @@ func Build(root string, in []Input, now time.Time, d Disk, claims *Claims) []Cha return in[order[i]].File.Rel < in[order[j]].File.Rel }) + // Every scanned file's own path counts as spoken for (review M4): no step + // of this plan may trash another scanned file to make room - it may be + // about to move away, or be acted on by its own chain - so overwrite + // takes a free name there, exactly as suffix already did for a path that + // exists on disk. + for _, x := range in { + claims.taken[x.File.Path] = true + } chains := make([]Chain, len(in)) for _, i := range order { chains[i] = buildOne(root, in[i], now, d, claims.taken) |
