summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-07-05 10:05:56 +0530
committerArun Isaac2022-07-05 10:05:56 +0530
commit80acb7203d05607bd3601b5b0931c977f2687ffd (patch)
treea3fa752ef0e37c50f1bed3dc98e4fa5162fe067a /bin
parent9398c1869801f120927ca4c27188d43e2c0e4db2 (diff)
downloadtissue-80acb7203d05607bd3601b5b0931c977f2687ffd.tar.gz
tissue-80acb7203d05607bd3601b5b0931c977f2687ffd.tar.lz
tissue-80acb7203d05607bd3601b5b0931c977f2687ffd.zip
bin: Do not error out when current repository is not found.
* bin/tissue: Import (rnrs conditions).
(default-configuration): Do not error out when current repository is
not found.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue17
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/tissue b/bin/tissue
index 006a94a..1dab955 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -20,7 +20,8 @@ exec guile --no-auto-compile -s "$0" "$@"
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with tissue.  If not, see <https://www.gnu.org/licenses/>.
 
-(import (rnrs exceptions)
+(import (rnrs conditions)
+        (rnrs exceptions)
         (rnrs io ports)
         (srfi srfi-1)
         (srfi srfi-9)
@@ -219,9 +220,17 @@ Export the repository as a website to OUTPUT-DIRECTORY.
 `tissue run-web' subcommands."
   `((listen . "127.0.0.1:8080")
     (state-directory . "/var/lib/tissue")
-    ;; Assume current repository as default.
-    (hosts ("localhost"
-            (upstream-repository . ,(git-top-level))))))
+    ;; Assume current repository as default. If there is no current
+    ;; repository, do not configure any hosts.
+    (hosts . ,(guard (c ((and (irritants-condition? c)
+                              (match (condition-irritants c)
+                                ((git-error _ ...)
+                                 (= (git-error-code git-error)
+                                    GIT_ENOTFOUND))
+                                (_ #f)))
+                         '()))
+                `(("localhost"
+                   (upstream-repository . ,(git-top-level))))))))
 
 (define tissue-run-web
   (match-lambda*