diff options
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 05bcfaf3..09e65402 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -15,7 +15,13 @@ #ifndef INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_REPO_HPP #define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_REPO_HPP +#include <filesystem> #include <functional> +#include <optional> +#include <string> +#include <unordered_map> +#include <variant> +#include <vector> #include "src/buildtool/common/bazel_types.hpp" #include "src/buildtool/file_system/git_cas.hpp" @@ -178,12 +184,15 @@ class GitRepo { /// \brief Get the tree id of a subtree given the root commit /// Calling it from a fake repository allows thread-safe use. - /// Returns the subtree hash, as a string, or nullopt if failure. + /// Returns an error + data union, where at index 0 is a flag stating the + /// nature of the error on failure (true is fatal, false is non-fatal, i.e., + /// commit not found), and at index 1 is the subtree hash on success. /// It guarantees the logger is called exactly once with fatal if failure. [[nodiscard]] auto GetSubtreeFromCommit( std::string const& commit, std::string const& subdir, - anon_logger_ptr const& logger) noexcept -> std::optional<std::string>; + anon_logger_ptr const& logger) noexcept + -> std::variant<bool, std::string>; /// \brief Get the tree id of a subtree given the root tree hash /// Calling it from a fake repository allows thread-safe use. |