From ce77909c3f0d9b6b3c5f8099883fa8d86131472c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 5 Dec 2023 21:13:03 +0100 Subject: [PATCH] Include proxy in Git configuration Follows the suggestion from there: https://www.klayout.de/forum/discussion/2404. Using $KLAYOUT_GIT_HTTP_PROXY so it does not interfere with curl. --- src/tl/tl/tlGit.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tl/tl/tlGit.cc b/src/tl/tl/tlGit.cc index 851e8fcd1..118b1d188 100644 --- a/src/tl/tl/tlGit.cc +++ b/src/tl/tl/tlGit.cc @@ -27,6 +27,7 @@ #include "tlProgress.h" #include "tlStaticObjects.h" #include "tlLog.h" +#include "tlEnv.h" #include #include @@ -314,6 +315,16 @@ GitObject::read (const std::string &org_url, const std::string &org_filter, cons fetch_opts.callbacks.credentials = &credentials_cb; fetch_opts.callbacks.payload = (void *) &progress; + // get proxy configuration from environment variable if available + // (see https://www.klayout.de/forum/discussion/2404) + + std::string http_proxy = tl::get_env ("KLAYOUT_GIT_HTTP_PROXY"); + + if (! http_proxy.empty ()) { + fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED; + fetch_opts.proxy_opts.url = http_proxy.c_str (); + } + // build refspecs in case they are needed char *refs[] = { (char *) branch.c_str () };