aboutsummaryrefslogtreecommitdiff
path: root/internal/plan/chain.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/plan/chain.go')
-rw-r--r--internal/plan/chain.go8
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)