diff --git a/core/local/change.js b/core/local/change.js index 37819c953..759cbfef6 100644 --- a/core/local/change.js +++ b/core/local/change.js @@ -81,6 +81,7 @@ const sideName = 'local' function build (type /*: string */, path /*: string */, opts /*: ?{stats?: fs.Stats, md5sum?: string, old?: ?Metadata} */) /*: LocalChange */ { const change /*: Object */ = _.assign({sideName, type, path}, opts) if (change.wip == null) delete change.wip + if (change.overwrite == null) delete change.overwrite if (change.md5sum == null) delete change.md5sum return change } @@ -169,6 +170,7 @@ function dirMoveFromUnlinkAdd (unlinkChange /*: LocalDirDeletion */, e /*: Local stats: e.stats, old: unlinkChange.old, ino: unlinkChange.ino, + overwrite: e.old, wip: e.wip }) } diff --git a/test/scenarios/move_overwriting_dir/local/finder_manual.json b/test/scenarios/move_overwriting_dir/local/finder_manual.json index 9c5ecca4b..f0fc652b9 100644 --- a/test/scenarios/move_overwriting_dir/local/finder_manual.json +++ b/test/scenarios/move_overwriting_dir/local/finder_manual.json @@ -19,6 +19,15 @@ "ctime": "2017-10-09T13:22:01.546Z" } }, + { + "type": "addDir", + "path": "dst/dir/subdir/subsub", + "stats": { + "ino": 15, + "mtime": "2017-10-09T13:21:59.535Z", + "ctime": "2017-10-09T13:22:01.546Z" + } + }, { "type": "addDir", "path": "dst/dir", @@ -45,6 +54,10 @@ "type": "unlink", "path": "dst/dir/subdir/file5" }, + { + "type": "unlinkDir", + "path": "dst/dir/subdir/subsub" + }, { "type": "unlink", "path": "dst/dir/subdir/file" diff --git a/test/scenarios/move_overwriting_dir/scenario.js b/test/scenarios/move_overwriting_dir/scenario.js index 217a69876..0ea525cbd 100644 --- a/test/scenarios/move_overwriting_dir/scenario.js +++ b/test/scenarios/move_overwriting_dir/scenario.js @@ -18,7 +18,8 @@ module.exports = ({ { ino: 11, path: 'src/dir/file', content: 'overwriter' }, { ino: 12, path: 'src/dir/subdir/file', content: 'sub-overwriter' }, { ino: 13, path: 'src/dir/subdir/file6', content: 'sub-other' }, - { ino: 14, path: 'src/dir/file2', content: 'other' } + { ino: 14, path: 'src/dir/file2', content: 'other' }, + { ino: 15, path: 'src/dir/subdir/subsub/' } ], actions: [ {type: 'mv', force: true, src: 'src/dir', dst: 'dst/dir'} @@ -39,6 +40,7 @@ module.exports = ({ 'dst/dir/subdir/', 'dst/dir/subdir/file', 'dst/dir/subdir/file6', + 'dst/dir/subdir/subsub/', 'src/' ], // remoteTrash: [