mirror of
https://github.com/rclone/rclone.git
synced 2025-08-10 06:09:44 +02:00
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.)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user