move: fixed root source directories getting deleted after move - fixes #1849

This commit is contained in:
ishuah
2017-11-23 12:01:35 +03:00
parent c64ad851af
commit 6c62fced60
3 changed files with 4 additions and 22 deletions
+2 -10
View File
@@ -697,18 +697,10 @@ func (s *syncCopyMove) run() error {
}
}
// if DoMove, delete fsrc directory after
// if DoMove, delete empty fsrc subdirectories after
if s.DoMove {
//first delete any subdirectories in fsrc
//delete empty subdirectories that were part of the move
s.processError(deleteEmptyDirectories(s.fsrc, s.srcEmptyDirs))
//delete fsrc dir
s.processError(func() error {
err := TryRmdir(s.fsrc, "")
if err != nil {
Debugf(logDirName(s.fsrc, ""), "Failed to Rmdir: %v", err)
}
return nil
}())
}
return s.currentError()
}
+2 -2
View File
@@ -824,7 +824,7 @@ func testServerSideMove(t *testing.T, r *fstest.Run, withFilter bool) {
if withFilter {
fstest.CheckItems(t, r.Fremote, file2)
} else {
fstest.CheckRootDir(t, r.Fremote, false)
fstest.CheckItems(t, r.Fremote)
}
fstest.CheckItems(t, FremoteMove, file2, file1, file3u)
@@ -843,7 +843,7 @@ func testServerSideMove(t *testing.T, r *fstest.Run, withFilter bool) {
fstest.CheckItems(t, FremoteMove, file2)
} else {
fstest.CheckItems(t, FremoteMove2, file2, file1, file3u)
fstest.CheckRootDir(t, FremoteMove, false)
fstest.CheckItems(t, FremoteMove)
}
}