From 4309ecb7bf05197c5cd95419d9c5b7b63699c547 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 13 Jan 2025 13:08:40 +0100 Subject: Add to GitRepo common implementation of ImportToGit --- src/buildtool/file_system/git_repo.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/buildtool/file_system/git_repo.hpp') diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 798f9ffb..1e403fbe 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -315,6 +316,20 @@ class GitRepo { [[nodiscard]] auto GetConfigSnapshot() const noexcept -> std::shared_ptr; + /// \brief Import source directory to target git repository + /// \param storage_config Storage where the source must be imported to + /// \param source_dir Directory to import + /// \param commit_message Message of the commit + /// \param tagging_lock Mutex to protect critical git operations + /// \return The tree id of the commited directory on success or an + /// unexpected error as string on failure. + [[nodiscard]] static auto ImportToGit( + StorageConfig const& storage_config, + std::filesystem::path const& source_dir, + std::string const& commit_message, + gsl::not_null const& tagging_lock) noexcept + -> expected; + private: GitCASPtr git_cas_; // default to real repo, as that is non-thread-safe -- cgit v1.2.3