Compare commits
No commits in common. "2bdae98c7e471a317695956095ed33681ae93509" and "ce4050f1e26cf8ad40a507a0db5f59d7df0168fb" have entirely different histories.
2bdae98c7e
...
ce4050f1e2
@ -413,6 +413,8 @@ static int progress_cb(const git_indexer_progress *stats, void *payload) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int transport_certificate_check_cb(git_cert *cert, int valid, const char *host, void *payload) { return 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clone_or_fetch: clone if needed, else fetch
|
* clone_or_fetch: clone if needed, else fetch
|
||||||
*/
|
*/
|
||||||
@ -424,29 +426,12 @@ void CiLogic::clone_or_fetch(const std::filesystem::path &repo_dir,
|
|||||||
ensure_git_inited();
|
ensure_git_inited();
|
||||||
|
|
||||||
// Use proxy settings via env var if they exist
|
// Use proxy settings via env var if they exist
|
||||||
bool proxy = false;
|
const char* proxy = repo_url.rfind("https", 0) == 0 ? std::getenv("HTTPS_PROXY") : std::getenv("HTTP_PROXY");
|
||||||
git_proxy_options proxy_opts = GIT_PROXY_OPTIONS_INIT;
|
git_proxy_options proxy_opts = GIT_PROXY_OPTIONS_INIT;
|
||||||
{
|
if (proxy) {
|
||||||
const char* tmp_proxy = repo_url.rfind("https", 0) == 0 ? std::getenv("HTTPS_PROXY") : std::getenv("HTTP_PROXY");
|
proxy_opts.type = GIT_PROXY_SPECIFIED;
|
||||||
if (tmp_proxy) {
|
proxy_opts.url = proxy;
|
||||||
const char* no_proxy_env = std::getenv("NO_PROXY");
|
proxy_opts.certificate_check = transport_certificate_check_cb;
|
||||||
if (no_proxy_env) {
|
|
||||||
std::istringstream iss(std::string{no_proxy_env});
|
|
||||||
std::string entry;
|
|
||||||
bool found_no_proxy = false;
|
|
||||||
while (std::getline(iss, entry, ',')) {
|
|
||||||
if (!entry.empty() && repo_url.contains(entry)) {
|
|
||||||
found_no_proxy = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proxy = !found_no_proxy;
|
|
||||||
} else {
|
|
||||||
proxy = true;
|
|
||||||
proxy_opts.type = GIT_PROXY_SPECIFIED;
|
|
||||||
proxy_opts.url = tmp_proxy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git_repository* repo = nullptr;
|
git_repository* repo = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user