Skip to content

Commit

Permalink
Auto merge of #8986 - ehuss:fix-git-http-proxy, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix git http.proxy config setting.

The `http.proxy` setting in `~/.gitconfig` was never being used. This is because the `get_str` method of `git2::Config` requires a "snapshot" config. Otherwise, it aways returns an error of "get_string called on a live config object".

I'm not 100% positive it makes sense to fix this, since I'm uncertain this might introduce problems for people, but it seems to be the intent here.
  • Loading branch information
bors committed Jan 4, 2021
2 parents 6477083 + a7d0539 commit 2f218d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ fn http_proxy(config: &Config) -> CargoResult<Option<String>> {
return Ok(Some(s.clone()));
}
if let Ok(cfg) = git2::Config::open_default() {
if let Ok(s) = cfg.get_str("http.proxy") {
return Ok(Some(s.to_string()));
if let Ok(s) = cfg.get_string("http.proxy") {
return Ok(Some(s));
}
}
Ok(None)
Expand Down

0 comments on commit 2f218d0

Please sign in to comment.