pijul-clone: avoid panics on parsing remote URLs

[?]
Jan 12, 2021, 6:15 PM
5XMUEZMZXQ4T4HGZAGBZWT5YKEXOA7IWLZBSREWBHXLMGHXOFXZAC

Dependencies

  • [2] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [3] I52XSRUH Massive cleanup, and simplification
  • [4] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [5] 5QTMRUXN Fixing a race condition between progress bars
  • [6] 76PCXGML Pushing to, and pulling from the local repository
  • [7] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [8] UDHP4ZVB Fixing SSH asynchronicity issues

Change contents

  • replacement in pijul/src/remote/mod.rs at line 5
    [3.439][2.885:903]()
    use anyhow::bail;
    [3.439]
    [3.363]
    use anyhow::{bail, Context};
  • replacement in pijul/src/remote/mod.rs at line 121
    [3.55486][3.55486:55534]()
    pub fn repo_name(&self) -> Option<String> {
    [3.55486]
    [3.55534]
    pub fn repo_name(&self) -> Result<Option<String>, anyhow::Error> {
  • replacement in pijul/src/remote/mod.rs at line 125
    [3.55672][3.55672:55737]()
    Some(s.name.split_at(sep + 1).1.to_string())
    [3.55672]
    [3.55737]
    Ok(Some(s.name.split_at(sep + 1).1.to_string()))
  • replacement in pijul/src/remote/mod.rs at line 127
    [3.55762][3.55762:55816]()
    Some(s.name.as_str().to_string())
    [3.55762]
    [3.55816]
    Ok(Some(s.name.as_str().to_string()))
  • replacement in pijul/src/remote/mod.rs at line 132
    [3.55947][3.55947:56008]()
    Some(file.to_str().unwrap().to_string())
    [3.55947]
    [3.56008]
    Ok(Some(
    file.to_str()
    .context("failed to decode local repository name")?
    .to_string(),
    ))
  • replacement in pijul/src/remote/mod.rs at line 138
    [3.56033][3.56033:56058]()
    None
    [3.56033]
    [3.56058]
    Ok(None)
  • replacement in pijul/src/remote/mod.rs at line 142
    [3.56131][3.56131:56195]()
    let url = reqwest::Url::parse(&h.url).unwrap();
    [3.56131]
    [3.56195]
    let url =
    reqwest::Url::parse(&h.url).context("failed to parse remote repository URL")?;
  • replacement in pijul/src/remote/mod.rs at line 145
    [3.56271][3.56271:56314]()
    Some(name.to_string())
    [3.56271]
    [3.56314]
    Ok(Some(name.to_string()))
  • replacement in pijul/src/remote/mod.rs at line 147
    [3.56339][3.56339:56393]()
    url.host().map(|h| h.to_string())
    [3.56339]
    [3.56393]
    Ok(url.host().map(|h| h.to_string()))
  • replacement in pijul/src/remote/mod.rs at line 150
    [3.56425][3.1344:1393]()
    RemoteRepo::LocalChannel(_) => None,
    [3.56425]
    [3.56425]
    RemoteRepo::LocalChannel(_) => Ok(None),
  • replacement in pijul/src/commands/clone.rs at line 51
    [3.184241][3.184241:184297]()
    } else if let Some(path) = remote.repo_name() {
    [3.184241]
    [3.184297]
    } else if let Some(path) = remote.repo_name()? {