Revert "operations: fix error reporting which was causing mount to overwrite directories."

This reverts commit 2d0007d1a5.
This commit is contained in:
Nick Craig-Wood 2024-12-18 17:25:15 +00:00
parent 2d0007d1a5
commit 3fabae87fe
2 changed files with 1 additions and 42 deletions

View File

@ -2404,7 +2404,7 @@ func DirMove(ctx context.Context, f fs.Fs, srcRemote, dstRemote string) (err err
if err == nil {
accounting.Stats(ctx).Renames(1)
}
if err != fs.ErrorCantDirMove {
if err != fs.ErrorCantDirMove && err != fs.ErrorDirExists {
return err
}
fs.Infof(f, "Can't DirMove - falling back to file moves: %v", err)

View File

@ -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) {
r := fstest.NewRun(t)