From 8d4f583d63c657397583f778096b8bcb6d96c12f Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 26 May 2025 10:41:15 +0200 Subject: Add utility methods for caching valid trees ...through marker files kept in storage under generation regime. These can be used to allow valid source trees, i.e., those free of upwards symlinks, to be cached in a persistent manner over multiple builds. --- src/buildtool/storage/fs_utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/buildtool/storage/fs_utils.cpp') diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp index 528dd8dd..861c8728 100644 --- a/src/buildtool/storage/fs_utils.cpp +++ b/src/buildtool/storage/fs_utils.cpp @@ -119,6 +119,14 @@ auto GetRehashIDFile(StorageConfig const& storage_config, (from_git ? "from-git" : "from-cas") / hash; } +auto GetValidTreesMarkerFile(StorageConfig const& storage_config, + std::string const& tree_hash, + std::size_t generation) noexcept + -> std::filesystem::path { + return storage_config.GenerationCacheRoot(generation) / + "validated-git-trees" / tree_hash; +} + auto WriteTreeIDFile(std::filesystem::path const& tree_id_file, std::string const& tree_id) noexcept -> bool { // needs to be done safely, so use the rename trick -- cgit v1.2.3