From 51130a4ef9bfb4139ffb748d1e0e4f491a442bfd Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 19 Jan 2023 10:58:07 +0100 Subject: GitRepo: Add libgit2 proxy options for remote connection for commit update --- src/buildtool/file_system/git_repo.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (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 713c73b9..3ad5ba0c 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -790,10 +790,17 @@ auto GitRepo::GetCommitFromRemote(std::string const& repo_url, // connect to remote git_remote_callbacks callbacks{}; git_remote_init_callbacks(&callbacks, GIT_REMOTE_CALLBACKS_VERSION); + + git_proxy_options proxy_opts{}; + git_proxy_options_init(&proxy_opts, GIT_PROXY_OPTIONS_VERSION); + + // set the option to auto-detect proxy settings + proxy_opts.type = GIT_PROXY_AUTO; + if (git_remote_connect(remote.get(), GIT_DIRECTION_FETCH, &callbacks, - nullptr, + &proxy_opts, nullptr) != 0) { (*logger)( fmt::format("connecting to remote {} for git repository {} " -- cgit v1.2.3