From 7f98d19a8c6a6697e246338d2c3a0640cd9528c8 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 23 Jan 2023 14:53:03 +0100 Subject: Just-MR: Remove obsolete GET_BRANCH_REFNAME critical Git operation As now all remote Git operations in GitRepo require at most just the branch name, there is no more need to inquire the repository about branch refspecs. --- src/other_tools/git_operations/git_operations.cpp | 35 ----------------------- 1 file changed, 35 deletions(-) (limited to 'src/other_tools/git_operations/git_operations.cpp') diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp index bf6b29b3..cdefaef9 100644 --- a/src/other_tools/git_operations/git_operations.cpp +++ b/src/other_tools/git_operations/git_operations.cpp @@ -141,38 +141,3 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params, // success return GitOpValue({git_repo->GetGitCAS(), *head_commit}); } - -auto CriticalGitOps::GitGetBranchRefname( - GitOpParams const& crit_op_params, - AsyncMapConsumerLoggerPtr const& logger) -> GitOpValue { - // Make sure folder we want to access exists - if (not FileSystemManager::Exists(crit_op_params.target_path)) { - (*logger)(fmt::format("target directory {} does not exist!", - crit_op_params.target_path.string()), - true /*fatal*/); - return GitOpValue{nullptr, std::nullopt}; - } - // Open a GitRepo at given location - auto git_repo = GitRepo::Open(crit_op_params.target_path); - if (git_repo == std::nullopt) { - (*logger)(fmt::format("could not open git repository {}", - crit_op_params.target_path.string()), - true /*fatal*/); - return GitOpValue{nullptr, std::nullopt}; - } - // setup wrapped logger - auto wrapped_logger = std::make_shared( - [logger](auto const& msg, bool fatal) { - (*logger)( - fmt::format("While doing get branch refname Git op:\n{}", msg), - fatal); - }); - // Get branch refname - auto branch_refname = - git_repo->GetBranchLocalRefname(crit_op_params.branch, wrapped_logger); - if (branch_refname == std::nullopt) { - return GitOpValue{nullptr, std::nullopt}; - } - // success - return GitOpValue{git_repo->GetGitCAS(), *branch_refname}; -} -- cgit v1.2.3