summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-06-05 10:31:45 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-06-11 15:46:35 +0200
commit2fc0c3c4c5a52a9fcb78a77fe79703896720c009 (patch)
treee98ed26eae0c4209db7970641e345f0b2270b3be /src/buildtool/file_system/git_repo.hpp
parent0f0126743af2418155d9cbfc7419108bb77b331e (diff)
downloadjustbuild-2fc0c3c4c5a52a9fcb78a77fe79703896720c009.tar.gz
GitRepo: Fix wrong handling of fatal logging
...in creating Git tree from filesystem directory. (cherry-picked from 6b31a88acbe6a6556e36f838b914a82879949811)
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp
index f8591d75..4d54e23e 100644
--- a/src/buildtool/file_system/git_repo.hpp
+++ b/src/buildtool/file_system/git_repo.hpp
@@ -348,13 +348,17 @@ class GitRepo {
/// \brief Open real repository at given location.
explicit GitRepo(std::filesystem::path const& repo_path) noexcept;
- using StoreDirEntryFunc =
- std::function<bool(std::filesystem::path const&, ObjectType type)>;
+ /// \brief Function type handling directory entries read from filesystem.
+ /// \returns Success flag. Must guarantee that the logger is called exactly
+ /// once with fatal if returning false.
+ using StoreDirEntryFunc = std::function<
+ bool(std::filesystem::path const&, ObjectType, anon_logger_ptr const&)>;
/// \brief Helper function to read the entries of a filesystem subdirectory
/// and store them to the ODB. It is a modified version of the same-named
/// function from FileSystemManager which accepts a subdir and a specific
/// logger instead of the default.
+ /// It guarantees the logger is called exactly once with fatal if failure.
[[nodiscard]] static auto ReadDirectory(
std::filesystem::path const& dir,
StoreDirEntryFunc const& read_and_store_entry,
@@ -363,6 +367,7 @@ class GitRepo {
/// \brief Create a tree from the content of a directory by recursively
/// adding its entries to the object database.
/// \return The raw id of the tree.
+ /// It guarantees the logger is called exactly once with fatal if failure.
[[nodiscard]] auto CreateTreeFromDirectory(
std::filesystem::path const& dir,
anon_logger_ptr const& logger) noexcept -> std::optional<std::string>;