summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-04-04 16:36:48 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-04-10 15:25:14 +0200
commitd3ec6b7294d44e1cd524ac5bbb9048d415950e99 (patch)
tree373735cc6edf9f78312c352aa3030742a42e22ac /src/buildtool/file_system/git_repo.hpp
parent4fe5fc8aec6e391a5e300e234bdc41375bff1d9e (diff)
downloadjustbuild-d3ec6b7294d44e1cd524ac5bbb9048d415950e99.tar.gz
GitRepo: Add method to keep tree alive by tagging
Also adds an appropriate test for this method.
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp
index 60353a00..54706e41 100644
--- a/src/buildtool/file_system/git_repo.hpp
+++ b/src/buildtool/file_system/git_repo.hpp
@@ -183,6 +183,15 @@ class GitRepo {
anon_logger_ptr const& logger) noexcept
-> bool;
+ /// \brief Ensure given tree is kept alive via a tag. It is expected that
+ /// the tree is part of the repository already.
+ /// Only possible with real repository and thus non-thread-safe.
+ /// Returns success flag.
+ /// It guarantees the logger is called exactly once with fatal if failure.
+ [[nodiscard]] auto KeepTree(std::string const& tree_id,
+ std::string const& message,
+ anon_logger_ptr const& logger) noexcept -> bool;
+
/// \brief Get the tree id of a subtree given the root commit
/// Calling it from a fake repository allows thread-safe use.
/// Returns an error + data union, where at index 0 is a flag stating the