summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-19 10:58:07 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 15:47:31 +0100
commit51130a4ef9bfb4139ffb748d1e0e4f491a442bfd (patch)
treeb4a8d7a792ad16ca4ee54969791d7fe1d4772911 /src/buildtool/file_system/git_repo.cpp
parentf92efe2fe8169c37f784af209ea56860a5b9a5cb (diff)
downloadjustbuild-51130a4ef9bfb4139ffb748d1e0e4f491a442bfd.tar.gz
GitRepo: Add libgit2 proxy options for remote connection for commit update
Diffstat (limited to 'src/buildtool/file_system/git_repo.cpp')
-rw-r--r--src/buildtool/file_system/git_repo.cpp9
1 files changed, 8 insertions, 1 deletions
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 {} "