From: Frank Duncan Date: Fri, 10 Dec 2021 13:08:54 +0000 (-0600) Subject: Clone project when adding X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=commitdiff_plain;h=da046d80f2ea35db8bc03ee7691308ec3fbedd56;p=candle Clone project when adding --- diff --git a/src/main/base.lisp b/src/main/base.lisp index 133e515..3fe9dbe 100644 --- a/src/main/base.lisp +++ b/src/main/base.lisp @@ -4,3 +4,6 @@ (lame-db:defdbstruct project name src) (lame-db:defdbstruct job status sha when-run (project :join project)) + +(defun project-dir (project) + (format nil "~Arepos/~A/" *candle-dir* (project-name project))) diff --git a/src/main/server.lisp b/src/main/server.lisp index 163ba5a..4a0866e 100644 --- a/src/main/server.lisp +++ b/src/main/server.lisp @@ -23,7 +23,13 @@ (when (not (git nil "ls-remote" src)) (error "Project uri is not a valid git repository")) - (make-project :name name :src src) + (when + (find name *all-project* :test #'string= :key #'project-name) + (error "Project name already taken")) + (let + ((project (make-project :name name :src src))) + (ensure-directories-exist (project-dir project)) + (git project "clone" src ".")) t) (defun add-job (project-name sha)