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 dc189f3151a5ce7ab8f26549c17158d26ae86702
parent e01814c408df42afc9ee6c7c6f88689466c69310
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 {