mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
win: rework rename notification a bit
Summary: When files are moved in and out the repo, the paths being passed in might be empty. For code clarity, let's treat these as file creation and removal. We also do not need to actually tell ProjectedFS about removed files, since ProjectedFS is actually telling us that the file is moved/removed. Reviewed By: fanzeyi Differential Revision: D22250851 fbshipit-source-id: a678e58eb9c36d4dcbf1bb41d56b38fef8943284
This commit is contained in:
parent
50eaecdbf3
commit
9de603d063
@ -380,31 +380,22 @@ void EdenDispatcher::notification(
|
||||
auto destFile = wideCharToEdenRelativePath(destinationFileName);
|
||||
XLOGF(DBG6, "RENAMED {} -> {}", relPath, destFile);
|
||||
|
||||
if (!destFile.empty()) {
|
||||
// When files are moved in and out of the repo, the rename paths are
|
||||
// empty, handle these like creation/removal of files.
|
||||
if (relPath.empty()) {
|
||||
getMount().createFile(destFile, isDirectory);
|
||||
} else if (destFile.empty()) {
|
||||
getMount().removeFile(relPath, isDirectory);
|
||||
} else {
|
||||
getMount().renameFile(relPath, destFile);
|
||||
}
|
||||
|
||||
// The Prjfs could create a Tombstones for the original file. If the
|
||||
// Tombstone will be created or not depends on the origin of the file.
|
||||
// We do not have that info here, so we try to remove the Tombstone and
|
||||
// not worry about the failures.
|
||||
|
||||
if (!relPath.empty()) {
|
||||
// TODO(puneetk): We could add the file origin information in the
|
||||
// DirEntry and refer to that before calling removeDeletedFile.
|
||||
getMount().getFsChannel()->removeDeletedFile(relPath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PRJ_NOTIFICATION_FILE_HANDLE_CLOSED_FILE_DELETED:
|
||||
XLOGF(DBG6, "DELETED {}", relPath);
|
||||
getMount().removeFile(relPath, isDirectory);
|
||||
|
||||
// TODO(puneetk): (same as above) We could add the file origin
|
||||
// information in the DirEntry and refer to that before calling
|
||||
// removeDeletedFile.
|
||||
getMount().getFsChannel()->removeDeletedFile(relPath);
|
||||
break;
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user