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/buildtool/file_system/git_repo.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/buildtool/file_system/git_repo.cpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
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<std::string> { -#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 |