From 39fc14811a67cc4381de726840e7b852f7d126c9 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 30 May 2023 17:58:38 +0200 Subject: ObjectType: Add non-upwards symlinks as a known object type... ...but make sure it is still considered a special type. The only non-special entry types remain file, executable, and tree. --- src/buildtool/file_system/file_root.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/buildtool/file_system/file_root.hpp') diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp index ed03f55d..1d4b6f1c 100644 --- a/src/buildtool/file_system/file_root.hpp +++ b/src/buildtool/file_system/file_root.hpp @@ -182,7 +182,7 @@ class FileRoot { auto const& data = std::get(data_); auto ptr = data->LookupEntryByName(name); if (static_cast(ptr)) { - return ptr->IsBlob(); + return IsFileObject(ptr->Type()); } return false; } @@ -250,7 +250,7 @@ class FileRoot { auto const& data = std::get(data_); return Iterator{FilteredIterator{ data->begin(), data->end(), [](auto const& x) noexcept -> bool { - return x.second->IsBlob(); + return IsFileObject(x.second->Type()); }}}; } @@ -343,8 +343,8 @@ class FileRoot { // std::holds_alternative(root_) == true auto root_path = std::get(root_) / path; auto exists = FileSystemManager::Exists(root_path); - return (ignore_special_ ? exists and FileSystemManager::Type( - root_path) != std::nullopt + auto type = FileSystemManager::Type(root_path); + return (ignore_special_ ? exists and type and IsNonSpecialObject(*type) : exists); } @@ -354,7 +354,7 @@ class FileRoot { if (auto entry = std::get(root_).tree->LookupEntryByPath( file_path)) { - return entry->IsBlob(); + return IsFileObject(entry->Type()); } return false; } @@ -385,7 +385,9 @@ class FileRoot { if (auto entry = std::get(root_).tree->LookupEntryByPath( file_path)) { - return entry->Blob(); + if (IsFileObject(entry->Type())) { + return entry->Blob(); + } } return std::nullopt; } @@ -434,7 +436,7 @@ class FileRoot { if (auto entry = std::get(root_).tree->LookupEntryByPath( file_path)) { - if (entry->IsBlob()) { + if (IsFileObject(entry->Type())) { return entry->Type(); } } -- cgit v1.2.3