diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/repo_map/repos_to_setup_map.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/root_maps/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.cpp | 28 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.hpp | 10 |
4 files changed, 36 insertions, 14 deletions
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp index cb5f9293..0637b81d 100644 --- a/src/other_tools/repo_map/repos_to_setup_map.cpp +++ b/src/other_tools/repo_map/repos_to_setup_map.cpp @@ -561,11 +561,19 @@ void GitTreeCheckout(ExpressionPtr const& repo_desc, } } } + // get ignore-special entry + auto repo_desc_ignore_special = + repo_desc->Get("ignore_special", Expression::none_t{}); + bool ignore_special = repo_desc_ignore_special->IsBool() + ? repo_desc_ignore_special->Bool() + : false; // populate struct TreeIdInfo tree_id_info = { repo_desc_hash->get()->String(), /* hash */ std::move(env), /* env_vars */ - std::move(cmd) /* command */ + std::move(cmd), /* command */ + repo_name, /* origin */ + ignore_special /* ignore_special */ }; // get the WS root as git tree tree_id_git_map->ConsumeAfterKeysReady( diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS index 9182f2ee..d325daa4 100644 --- a/src/other_tools/root_maps/TARGETS +++ b/src/other_tools/root_maps/TARGETS @@ -93,6 +93,7 @@ , "deps": [ ["@", "json", "", "json"] , ["src/other_tools/ops_maps", "critical_git_op_map"] + , ["src/utils/cpp", "hash_combine"] ] , "stage": ["src", "other_tools", "root_maps"] , "private-deps": @@ -107,6 +108,7 @@ , ["src/other_tools/just_mr/progress_reporting", "statistics"] , ["src/other_tools/ops_maps", "content_cas_map"] , ["src/other_tools/ops_maps", "import_to_git_map"] + , ["src/buildtool/file_system", "file_root"] , ["@", "fmt", "", "fmt"] ] } diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp index a4a1c91a..27474c52 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -16,6 +16,7 @@ #include "fmt/core.h" #include "src/buildtool/execution_api/common/execution_common.hpp" +#include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/system/system_command.hpp" @@ -58,11 +59,14 @@ void KeepCommitAndSetRoot( } // set the workspace root JustMRProgress::Instance().TaskTracker().Start(tree_id_info.origin); - (*ws_setter)(std::pair( - nlohmann::json::array({"git tree", - tree_id_info.hash, - StorageConfig::GitRoot().string()}), - false)); + (*ws_setter)( + std::pair(nlohmann::json::array( + {tree_id_info.ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, + tree_id_info.hash, + StorageConfig::GitRoot().string()}), + false)); }, [logger, commit, target_path = tmp_dir->GetPath()](auto const& msg, bool fatal) { @@ -337,12 +341,14 @@ auto CreateTreeIdGitMap( } else { // tree found, so return the git tree root as-is - (*setter)( - std::pair(nlohmann::json::array( - {"git tree", - key.hash, - StorageConfig::GitRoot().string()}), - true)); + (*setter)(std::pair( + nlohmann::json::array( + {key.ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, + key.hash, + StorageConfig::GitRoot().string()}), + true)); } }, [logger, target_path = StorageConfig::GitRoot()](auto const& msg, diff --git a/src/other_tools/root_maps/tree_id_git_map.hpp b/src/other_tools/root_maps/tree_id_git_map.hpp index 7e14e4fc..ca5fb9fb 100644 --- a/src/other_tools/root_maps/tree_id_git_map.hpp +++ b/src/other_tools/root_maps/tree_id_git_map.hpp @@ -20,6 +20,7 @@ #include "nlohmann/json.hpp" #include "src/other_tools/ops_maps/critical_git_op_map.hpp" +#include "src/utils/cpp/hash_combine.hpp" struct TreeIdInfo { std::string hash{}; /* key */ @@ -27,9 +28,11 @@ struct TreeIdInfo { std::vector<std::string> command{}; // name of repository for which work is done; used in progress reporting std::string origin{}; + // create root that ignores symlinks + bool ignore_special{}; /* key */ [[nodiscard]] auto operator==(const TreeIdInfo& other) const -> bool { - return hash == other.hash; + return hash == other.hash and ignore_special == other.ignore_special; } }; @@ -38,7 +41,10 @@ template <> struct hash<TreeIdInfo> { [[nodiscard]] auto operator()(const TreeIdInfo& ti) const noexcept -> std::size_t { - return std::hash<std::string>{}(ti.hash); + size_t seed{}; + hash_combine<std::string>(&seed, ti.hash); + hash_combine<bool>(&seed, ti.ignore_special); + return seed; } }; } // namespace std |