From f97c876eb16011bb4158b2a6a745ba18905a6cbf Mon Sep 17 00:00:00 2001 From: nielash Date: Tue, 24 Jun 2025 21:56:25 -0400 Subject: [PATCH] convmv: make --dry-run logs less noisy Before this change, convmv dry runs would log a SkipDestructive message for every single object, even objects that would not really be moved during a real run. This made it quite difficult to tell what would actually happen during the real run. This change fixes that by returning silently in such cases (as would happen during a real run.) --- fs/operations/operations.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index f89284c4f..23f6f2111 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -428,6 +428,10 @@ func move(ctx context.Context, fdst fs.Fs, dst fs.Object, remote string, src fs. origRemote := remote // avoid double-transform on fallback to copy remote = transform.Path(ctx, remote, false) ci := fs.GetConfig(ctx) + newDst = dst + if ci.DryRun && dst != nil && SameObject(src, dst) && src.Remote() == transform.Path(ctx, dst.Remote(), false) { + return // avoid SkipDestructive log for objects that won't really be moved + } var tr *accounting.Transfer if isTransfer { tr = accounting.Stats(ctx).NewTransfer(src, fdst) @@ -440,8 +444,11 @@ func move(ctx context.Context, fdst fs.Fs, dst fs.Object, remote string, src fs. } tr.Done(ctx, err) }() - newDst = dst - if SkipDestructive(ctx, src, "move") { + action := "move" + if remote != src.Remote() { + action += " to " + remote + } + if SkipDestructive(ctx, src, action) { in := tr.Account(ctx, nil) in.DryRun(src.Size()) return newDst, nil