Function cargo_update::ops::update_index[][src]

pub fn update_index<W: Write>(
    index_repo: &mut Repository,
    repo_url: &str,
    http_proxy: Option<&str>,
    fork_git: bool,
    out: &mut W
) -> Result<(), String>
Expand description

Update the specified index repository from the specified URL.

Historically, cargo search was used, first of an empty string, then a ZWNJ (why?).

The need for this in-house has first emerged with #93: since cargo v1.29.0-nightly, the registry was no longer updated. So a two-year-old cargo issue was dug up, asking for a cargo update-registry command, followed by a PR implementing this. Up to this point, there was no good substitute: cargo install lazy_static, the poster-child of replacements errored out and left garbage in the console, making it unsuitable.

But then, a man of steel eyes and hawk will has emerged, seemingly from nowhere, remarking:

[21:09] Eh2406: https://github.com/rust-lang/cargo/blob/1ee1ef0ea7ab47d657ca675e3b1bd2fcd68b5aab/src/cargo/sources/registry/remote. rs#L204
[21:10] Eh2406: looks like it is a git fetch of “refs/heads/master:refs/remotes/origin/master”
[21:11] Eh2406: You are already poking about in cargos internal representation of the index, is this so much more?

It, well, isn’t. And with some cargo maintainers being firmly against blind-merging that cargo update-registry PR, here I go recycling the same old song that implementation (but simpler, and badlier).

Honourable mentions:

  • @joshtriplett, for being a bastion for the people and standing with me in advocacy for cargo update-registry (NB: it was his issue from 2016 requesting it, funny how things turn around)
  • @alexcrichton, for not getting overly too fed up with me while managing that PR and producing a brilliant argument list for doing it in-house (as well as suggesting I write another crate for this)
  • And lastly, because mostly, @Eh2406, for swooping in and saving me in my hour of need not having a good replacement.

Most of this would have been impossible, of course, without the rust-lang Discord server, so shoutout to whoever convinced people that Discord is actually good.

Sometimes, however, even this isn’t enough (see https://github.com/nabijaczleweli/cargo-update/issues/163), hence fork_git, which actually runs $GIT (default: git).