summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp15
1 files changed, 15 insertions, 0 deletions
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 <filesystem>
#include <functional>
#include <memory>
+#include <mutex>
#include <optional>
#include <string>
#include <unordered_map>
@@ -315,6 +316,20 @@ class GitRepo {
[[nodiscard]] auto GetConfigSnapshot() const noexcept
-> std::shared_ptr<git_config>;
+ /// \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<std::mutex*> const& tagging_lock) noexcept
+ -> expected<std::string, std::string>;
+
private:
GitCASPtr git_cas_;
// default to real repo, as that is non-thread-safe