summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/file_system/file_root.hpp12
-rw-r--r--src/buildtool/file_system/git_repo.cpp4
2 files changed, 10 insertions, 6 deletions
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index b2768471..b332f9cd 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -213,8 +213,7 @@ class FileRoot {
}
/// \brief Retrieve a root tree as a KNOWN artifact.
- /// User should know whether this root tree is symlink free and only
- /// call this function accordingly.
+ /// Only succeeds if no entries have to be ignored.
[[nodiscard]] auto AsKnownTree(std::string const& repository)
const noexcept -> std::optional<ArtifactDescription> {
if (Compatibility::IsCompatible()) {
@@ -223,6 +222,10 @@ class FileRoot {
if (std::holds_alternative<tree_t>(data_)) {
try {
auto const& data = std::get<tree_t>(data_);
+ // check if tree is ignore_special
+ if (data->RawHash().empty()) {
+ return std::nullopt;
+ }
auto const& id = data->Hash();
auto const& size = data->Size();
if (size) {
@@ -502,11 +505,10 @@ class FileRoot {
}
/// \brief Read a root tree based on its ID.
- /// User should know whether the desired tree is symlink free and only call
- /// this function accordingly.
+ /// This should include all valid entry types.
[[nodiscard]] auto ReadTree(std::string const& tree_id) const noexcept
-> std::optional<GitTree> {
- if (std::holds_alternative<git_root_t>(root_) and not ignore_special_) {
+ if (std::holds_alternative<git_root_t>(root_)) {
try {
auto const& cas = std::get<git_root_t>(root_).cas;
return GitTree::Read(cas, tree_id);
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index 4dbbca39..bb60c68b 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -149,7 +149,9 @@ std::unordered_set<git_filemode_t> const kNonSpecialGitFileModes{
return 1; // return >=0 on success, 1 == skip subtrees (flat)
}
}
- Logger::Log(LogLevel::Error, "failed walk for git tree entry: {}", name);
+ Logger::Log(LogLevel::Error,
+ "failed ignore_special walk for git tree entry: {}",
+ name);
return -1; // fail
}