mirror of
https://github.com/rclone/rclone.git
synced 2025-07-01 04:50:12 +02:00
Revert "operations: fix error reporting which was causing mount to overwrite directories."
This reverts commit 2d0007d1a5
.
This commit is contained in:
@ -2404,7 +2404,7 @@ func DirMove(ctx context.Context, f fs.Fs, srcRemote, dstRemote string) (err err
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
accounting.Stats(ctx).Renames(1)
|
accounting.Stats(ctx).Renames(1)
|
||||||
}
|
}
|
||||||
if err != fs.ErrorCantDirMove {
|
if err != fs.ErrorCantDirMove && err != fs.ErrorDirExists {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fs.Infof(f, "Can't DirMove - falling back to file moves: %v", err)
|
fs.Infof(f, "Can't DirMove - falling back to file moves: %v", err)
|
||||||
|
@ -1452,47 +1452,6 @@ func TestDirMove(t *testing.T) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDirMoveOverwrite(t *testing.T) {
|
|
||||||
ctx := context.Background()
|
|
||||||
r := fstest.NewRun(t)
|
|
||||||
|
|
||||||
if !r.Fremote.Features().CanHaveEmptyDirectories {
|
|
||||||
t.Skip("Can't test for directory overwrite if can't have empty directories")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.Mkdir(ctx, r.Fremote)
|
|
||||||
|
|
||||||
// Make some files and dirs
|
|
||||||
r.ForceMkdir(ctx, r.Fremote)
|
|
||||||
require.NoError(t, operations.Mkdir(ctx, r.Fremote, "dir1"))
|
|
||||||
require.NoError(t, operations.Mkdir(ctx, r.Fremote, "dir2"))
|
|
||||||
|
|
||||||
fstest.CheckListingWithPrecision(
|
|
||||||
t,
|
|
||||||
r.Fremote,
|
|
||||||
nil,
|
|
||||||
[]string{
|
|
||||||
"dir1",
|
|
||||||
"dir2",
|
|
||||||
},
|
|
||||||
fs.GetModifyWindow(ctx, r.Fremote),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Check we get an error if we try to overwrite an existing directory
|
|
||||||
require.Error(t, operations.DirMove(ctx, r.Fremote, "dir1", "dir2"))
|
|
||||||
|
|
||||||
fstest.CheckListingWithPrecision(
|
|
||||||
t,
|
|
||||||
r.Fremote,
|
|
||||||
nil,
|
|
||||||
[]string{
|
|
||||||
"dir1",
|
|
||||||
"dir2",
|
|
||||||
},
|
|
||||||
fs.GetModifyWindow(ctx, r.Fremote),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFsInfo(t *testing.T) {
|
func TestGetFsInfo(t *testing.T) {
|
||||||
r := fstest.NewRun(t)
|
r := fstest.NewRun(t)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user