Avoid cloning into an existing path
[?]
Jan 4, 2021, 9:03 PM
LYTVEPH3W5UHF7MAYFWBT6NVNC42HEVKJGGMFDKUDZDNDOI33YJQCDependencies
- [2]
TPEH2XNB1.0.0-alpha.28, with Tokio 1.0 - [3]
L4LAD4XMFixing clone on WSL (Windows Subsystem for Linux) - [4]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [5]
I52XSRUHMassive cleanup, and simplification - [6]
Q45QHPO4Feedback on network stuff - [7]
UFCZKKLXUpgrading to the latest Sanakirja/Rand - [8]
BT2ZHPY4Version bumps - [9]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [10]
GHO6DWPIRefactoring iterators - [11]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [*]
2K7JLB4ZNo pager on Windows - [*]
XWETQ4DEUpgrading versions - [*]
SAGSYAPXVarious version bumps
Change contents
- edit in pijul/src/commands/clone.rs at line 1
use std::io::Write; - edit in pijul/src/commands/clone.rs at line 8
use tempfile::TempDir; - replacement in pijul/src/commands/clone.rs at line 58
let parent = std::fs::canonicalize(path.parent().unwrap())?;let temp = TempDir::new_in(&parent)?;debug!("temp = {:?}", temp.path());let mut repo = Repository::init(Some(temp.path().to_path_buf()))?;let path_ = path.clone();ctrlc::set_handler(move || {std::fs::remove_dir_all(&path_).unwrap_or(());}).unwrap_or(());let repo_path = RepoPath(path);let mut repo = Repository::init(Some(repo_path.0.clone()))?; - replacement in pijul/src/commands/clone.rs at line 112[3.30]→[3.2591:2732](∅→∅),[3.2732]→[3.62:211](∅→∅),[3.211]→[3.2772:2839](∅→∅),[3.2772]→[3.2772:2839](∅→∅)
let temp = temp.into_path();if let Err(e) = std::fs::rename(&temp, &path) {let mut stderr = std::io::stderr();writeln!(stderr,"Error while renaming {:?} to {:?}: {}",temp, path, e)?;std::fs::remove_dir_all(temp).unwrap_or(());}std::mem::forget(repo_path); - edit in pijul/src/commands/clone.rs at line 116[3.185963]
struct RepoPath(PathBuf);impl Drop for RepoPath {fn drop(&mut self) {std::fs::remove_dir_all(&self.0).unwrap_or(());}} - edit in pijul/Cargo.toml at line 76
tempfile = "3.1" - edit in pijul/Cargo.toml at line 80
ctrlc = "3.1" - edit in Cargo.lock at line 310
"winapi 0.3.9",][[package]]name = "ctrlc"version = "3.1.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b57a92e9749e10f25a171adcebfafe72991d45e7ec2dcb853e8f83d9dafaeb08"dependencies = ["nix", - edit in Cargo.lock at line 1209
][[package]]name = "nix"version = "0.18.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055"dependencies = ["bitflags","cc","cfg-if 0.1.10","libc", - edit in Cargo.lock at line 1388[15.5811][3.1064186]
"ctrlc", - edit in Cargo.lock at line 1412
"tempfile",