summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/file_root.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-30 17:58:38 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-06-26 17:57:29 +0200
commit39fc14811a67cc4381de726840e7b852f7d126c9 (patch)
tree296b8e1394ec3a09042db71b48b0d3b8a05d0f15 /src/buildtool/file_system/file_root.hpp
parent0b924c5c23a89760ddecf8d8f6baa19333f9b667 (diff)
downloadjustbuild-39fc14811a67cc4381de726840e7b852f7d126c9.tar.gz
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.
Diffstat (limited to 'src/buildtool/file_system/file_root.hpp')
-rw-r--r--src/buildtool/file_system/file_root.hpp16
1 files changed, 9 insertions, 7 deletions
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<tree_t>(data_);
auto ptr = data->LookupEntryByName(name);
if (static_cast<bool>(ptr)) {
- return ptr->IsBlob();
+ return IsFileObject(ptr->Type());
}
return false;
}
@@ -250,7 +250,7 @@ class FileRoot {
auto const& data = std::get<tree_t>(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<fs_root_t>(root_) == true
auto root_path = std::get<fs_root_t>(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<git_root_t>(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<git_root_t>(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<git_root_t>(root_).tree->LookupEntryByPath(
file_path)) {
- if (entry->IsBlob()) {
+ if (IsFileObject(entry->Type())) {
return entry->Type();
}
}