links must have unique names by design

This commit is contained in:
IlyaShurupov 2024-03-31 13:13:30 +03:00
parent 9af73a9de8
commit 25069b5bbe
5 changed files with 13714 additions and 6198 deletions

View file

@ -6,8 +6,6 @@
#include <sstream>
// copy operator exit if exists, do not rename
// links have unique names
// update link if exists
class FileSystem {
public:

View file

@ -161,7 +161,7 @@ bool FileSystem::makeLink(const Path& source, const Path& target, bool isDynamic
return false;
}
const Key& key = source.getFilename();
const Key& key = isDynamic ? "dlink" : "hlink";
if (parentNodeTarget->findNode(key)) {
gError = "Node with such name already exists";

View file

@ -68,8 +68,7 @@ void Link::dumpUtil(std::ostream& ss, const Key& key, ui32 currentDepth, std::ve
indent(ss, currentDepth, indents);
ss << key;
ss << (isHardLink() ? " hlink[" : " dlink[");
ss << key << "[";
// ss << " [h" << mIncomingHardLinks.size() << ": d" << mIncomingDynamicLinks.size() << "] ";
for (auto it = path.begin(); it != path.end(); ++it) {

View file

@ -23,7 +23,7 @@ SUITE(FSE) {
CHECK(interp("copy a C:/"));
CHECK(!interp("deltree a"));
CHECK(interp("deltree a_copy"));
CHECK(interp("del a/b/a"));
CHECK(interp("del a/b/hlink"));
CHECK(interp("deltree a"));
CHECK(interp("md a"));

File diff suppressed because it is too large Load diff