Skip to content

A peer-to-peer stack for code collaboration

Handle failures in project checkout (#426)

Merle Breitkreuz2c764f1d5f86
diff --git a/bin/rad-project b/bin/rad-project
index 9148c81..6e907b0 100755
--- a/bin/rad-project
+++ b/bin/rad-project
@@ -57,9 +57,23 @@
(fetch! rsm)
(def name (lookup :name (get-meta! rsm)))
(def origin (lookup :id (first-rsm-of-type! rsm :rad-repo)))
- (put-str! name)
- (process! "git" ["clone" origin name] "")
- (cd! name)
+ (match (process! "test" ["-d" name] "")
+ :ok (do
+ (put-str! (string-append
+ "The directory \"" name "\" already exists.\n"
+ "Refusing to continue."))
+ (exit! 1))
+ _ (put-str! name))
+ (match (process! "git" ["clone" origin name] "")
+ :ok (cd! name)
+ _ (do
+ (put-str! (string-append
+ "The repo is currently not available. "
+ "Cloning \"" name "\" from \"" origin "\" failed.\n"
+ "This may be because you have no internet connection, "
+ "or the IPNS link is stale, or because no online node "
+ "with the data could be found."))
+ (exit! 1)))
(set-git-config! "radicle.project-id" project-url)))
(def new-or-forked-project!