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/buildtool/file_system/git_repo.cpp | 41 ---------------------------------- 1 file changed, 41 deletions(-) (limited to 'src/buildtool/file_system/git_repo.cpp') diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index d2d6c8ef..e7db261a 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -758,47 +758,6 @@ auto GitRepo::GetHeadCommit(anon_logger_ptr const& logger) noexcept #endif // BOOTSTRAP_BUILD_TOOL } -auto GitRepo::GetBranchLocalRefname(std::string const& branch, - anon_logger_ptr const& logger) noexcept - -> std::optional { -#ifdef BOOTSTRAP_BUILD_TOOL - return std::nullopt; -#else - try { - // only possible for real repository! - if (IsRepoFake()) { - (*logger)("cannot retrieve branch refname using a fake repository!", - true /*fatal*/); - return std::nullopt; - } - // get local reference of branch - git_reference* local_ref = nullptr; - if (git_branch_lookup( - &local_ref, repo_.get(), branch.c_str(), GIT_BRANCH_LOCAL) != - 0) { - (*logger)(fmt::format("retrieving branch {} local reference in git " - "repository {} failed with:\n{}", - branch, - GetGitCAS()->git_path_.string(), - GitLastError()), - true /*fatal*/); - // release resources - git_reference_free(local_ref); - return std::nullopt; - } - auto refname = std::string(git_reference_name(local_ref)); - // release resources - git_reference_free(local_ref); - return refname; - } catch (std::exception const& ex) { - Logger::Log(LogLevel::Error, - "get branch local refname failed with:\n{}", - ex.what()); - return std::nullopt; - } -#endif // BOOTSTRAP_BUILD_TOOL -} - auto GitRepo::GetCommitFromRemote(std::string const& repo_url, std::string const& branch, anon_logger_ptr const& logger) noexcept -- cgit v1.2.3