move: if --check-first and --order-by are set then delete with perfect ordering

If using rclone move and --check-first and --order-by then rclone uses
the transfer routine to delete files to ensure perfect ordering.

This will cause the transfer stats to have a larger than expected
number of items in it so we don't enable this by default.

Fixes #6033
This commit is contained in:
Nick Craig-Wood 2023-03-08 13:03:05 +00:00
parent 4edcd16f5f
commit dd6e229327
4 changed files with 38 additions and 4 deletions

View file

@ -42,12 +42,18 @@ func TestPipe(t *testing.T) {
obj1 := mockobject.New("potato").WithContent([]byte("hello"), mockobject.SeekModeNone)
pair1 := fs.ObjectPair{Src: obj1, Dst: nil}
pairD := fs.ObjectPair{Src: obj1, Dst: obj1} // this object should not count to the stats
// Put an object
ok := p.Put(ctx, pair1)
assert.Equal(t, true, ok)
checkStats(1, 5)
// Put an object to be deleted
ok = p.Put(ctx, pairD)
assert.Equal(t, true, ok)
checkStats(2, 5)
// Close the pipe showing reading on closed pipe is OK
p.Close()
@ -55,6 +61,12 @@ func TestPipe(t *testing.T) {
pair2, ok := p.Get(ctx)
assert.Equal(t, pair1, pair2)
assert.Equal(t, true, ok)
checkStats(1, 0)
// Read from pipe
pair2, ok = p.Get(ctx)
assert.Equal(t, pairD, pair2)
assert.Equal(t, true, ok)
checkStats(0, 0)
// Check read on closed pipe