diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-01-23 14:53:03 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-01-24 15:47:31 +0100 |
commit | 7f98d19a8c6a6697e246338d2c3a0640cd9528c8 (patch) | |
tree | 9013ea406c9d945ef0a622a89bd38b3830fa82b5 /src/other_tools/git_operations/git_operations.cpp | |
parent | 7c3313a3baaa3695081a9c17b521931877babad6 (diff) | |
download | justbuild-7f98d19a8c6a6697e246338d2c3a0640cd9528c8.tar.gz |
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.
Diffstat (limited to 'src/other_tools/git_operations/git_operations.cpp')
-rw-r--r-- | src/other_tools/git_operations/git_operations.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
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<AsyncMapConsumerLogger>( - [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}; -} |