When clone fails, only remove directories we have created (not other directories)
[?]
Jan 13, 2021, 4:12 PM
SQVWP4LU7AAJSEIHK5CNNUK3XBUVT3FGIJIOPTKMR53PO2P4ARNQCDependencies
- [2]
B3QWIGDEFixing the Git features with the latest Pijul (+ conflicts in Cargo.toml) - [3]
RGJWLQWBWhen cloning, try to init *before* setting up the path Drop (pijul::commands::clone::RepoPath) - [4]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [5]
LYTVEPH3Avoid cloning into an existing path
Change contents
- replacement in pijul/src/commands/clone.rs at line 60
let path_ = path.clone();let repo_path = RepoPath::new(path.clone());let repo_path_ = repo_path.clone(); - replacement in pijul/src/commands/clone.rs at line 63
std::fs::remove_dir_all(&path_).unwrap_or(());if repo_path_.remove {std::fs::remove_dir_all(&repo_path_.path).unwrap_or(());} - replacement in pijul/src/commands/clone.rs at line 70
let mut repo = Repository::init(Some(path.clone()))?;let repo_path = RepoPath(path);let mut repo = Repository::init(Some(path))?; - replacement in pijul/src/commands/clone.rs at line 129
struct RepoPath(PathBuf);#[derive(Debug, Clone)]struct RepoPath {path: PathBuf,remove: bool,}impl RepoPath {fn new(path: PathBuf) -> Self {RepoPath {remove: std::fs::metadata(&path).is_err(),path,}}} - replacement in pijul/src/commands/clone.rs at line 146
std::fs::remove_dir_all(&self.0).unwrap_or(());if self.remove {std::fs::remove_dir_all(&self.path).unwrap_or(());}