Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Collapse nested if
Matthias Beyer committed 8 months ago
commit 787cb3a87294cd1f03945f0dd481cb32b09cef63
parent b0af48aa033166693fe9a985dd764db3cf2ffae8
1 file changed +2 -4
modified crates/radicle-cli/src/commands/clone.rs
@@ -246,10 +246,8 @@ impl Checkout {
            .map_err(|err| CheckoutFailure::Payload { rid, err })?;
        let path = directory.unwrap_or_else(|| PathBuf::from(proj.name()));
        // N.b. fail if the path exists and is not empty
-
        if path.exists() {
-
            if path.read_dir().map_or(true, |mut dir| dir.next().is_some()) {
-
                return Err(CheckoutFailure::Exists { rid, path });
-
            }
+
        if path.exists() && path.read_dir().map_or(true, |mut dir| dir.next().is_some()) {
+
            return Err(CheckoutFailure::Exists { rid, path });
        }

        Ok(Self {