summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-07-03 01:59:14 +0530
committerArun Isaac2022-07-03 23:21:41 +0530
commitedd7e4010ed228572945a7520d8eaa51cecafe09 (patch)
tree627847f01d62e13a8b9142964fc70784be72b15d /bin
parent2562403d13daaabb1c6eb324b2c34b0c17e1656b (diff)
downloadtissue-edd7e4010ed228572945a7520d8eaa51cecafe09.tar.gz
tissue-edd7e4010ed228572945a7520d8eaa51cecafe09.tar.lz
tissue-edd7e4010ed228572945a7520d8eaa51cecafe09.zip
conditions: Deprecate &issue-file-not-found-error.
The &issue-file-not-found-error cannot occur anymore now that we are reading files directly from the git repository and not from the working tree. * tissue/conditions.scm: Delete file. * bin/tissue, tissue/web/server.scm, tissue/web/static.scm: Do not import (tissue conditions). * bin/tissue (main): Do not guard against &issue-file-not-found-error conditions.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue97
1 files changed, 45 insertions, 52 deletions
diff --git a/bin/tissue b/bin/tissue
index 3ee0565..22eae6f 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -37,7 +37,6 @@ exec guile --no-auto-compile -s "$0" "$@"
(git)
(xapian wrap)
(xapian xapian)
- (tissue conditions)
(tissue document)
(tissue git)
(tissue issue)
@@ -311,57 +310,51 @@ top-level of the git repository."
((_ "run-web" args ...)
(apply tissue-run-web args))
((_ command args ...)
- (guard (c ((issue-file-not-found-error? c)
- (display (string-append "No such file or directory: "
- (issue-file-not-found-error-issue-file c))
- (current-error-port))
- (newline (current-error-port))
- (exit #f)))
- (call-with-current-directory (git-top-level)
- (lambda ()
- (parameterize ((%aliases (tissue-configuration-aliases (load-config))))
- ;; Create hidden tissue directory unless it exists.
- (unless (file-exists? %state-directory)
- (mkdir %state-directory))
- ;; Ensure index exists rebuilding it if it is stale.
- (let ((current-head
- (oid->string (reference-name->oid
- (current-git-repository) "HEAD"))))
- (unless (and (file-exists? %xapian-index)
- (string=? (call-with-database %xapian-index
- (cut Database-get-metadata <> "commit"))
- current-head))
- (guard (c (else (delete-xapian-index)
- (display "Building xapian index failed."
- (current-error-port))
- (raise c)))
- (delete-xapian-index)
- (call-with-writable-database %xapian-index
- (lambda (db)
- (for-each (lambda (indexed-document)
- (let* ((document (slot-set ((indexed-document-reader indexed-document))
- 'web-uri
- (indexed-document-web-uri indexed-document)))
- (term-generator (document-term-generator document)))
- (index-text! term-generator (document-type document) #:prefix "XT")
- (replace-document! db
- (document-id-term document)
- (TermGenerator-get-document term-generator))))
- (tissue-configuration-indexed-documents (load-config)))
- (WritableDatabase-set-metadata db "commit" current-head))))))
- ;; Handle sub-command.
- (apply (match command
- ("search" tissue-search)
- ("show" tissue-show)
- ("repl" tissue-repl)
- ("web" tissue-web)
- ("index" tissue-index)
- (invalid-command
- (format (current-error-port) "Invalid command `~a'~%~%"
- invalid-command)
- (print-usage)
- (exit #f)))
- args))))))
+ (call-with-current-directory (git-top-level)
+ (lambda ()
+ (parameterize ((%aliases (tissue-configuration-aliases (load-config))))
+ ;; Create hidden tissue directory unless it exists.
+ (unless (file-exists? %state-directory)
+ (mkdir %state-directory))
+ ;; Ensure index exists rebuilding it if it is stale.
+ (let ((current-head
+ (oid->string (reference-name->oid
+ (current-git-repository) "HEAD"))))
+ (unless (and (file-exists? %xapian-index)
+ (string=? (call-with-database %xapian-index
+ (cut Database-get-metadata <> "commit"))
+ current-head))
+ (guard (c (else (delete-xapian-index)
+ (display "Building xapian index failed."
+ (current-error-port))
+ (raise c)))
+ (delete-xapian-index)
+ (call-with-writable-database %xapian-index
+ (lambda (db)
+ (for-each (lambda (indexed-document)
+ (let* ((document (slot-set ((indexed-document-reader indexed-document))
+ 'web-uri
+ (indexed-document-web-uri indexed-document)))
+ (term-generator (document-term-generator document)))
+ (index-text! term-generator (document-type document) #:prefix "XT")
+ (replace-document! db
+ (document-id-term document)
+ (TermGenerator-get-document term-generator))))
+ (tissue-configuration-indexed-documents (load-config)))
+ (WritableDatabase-set-metadata db "commit" current-head))))))
+ ;; Handle sub-command.
+ (apply (match command
+ ("search" tissue-search)
+ ("show" tissue-show)
+ ("repl" tissue-repl)
+ ("web" tissue-web)
+ ("index" tissue-index)
+ (invalid-command
+ (format (current-error-port) "Invalid command `~a'~%~%"
+ invalid-command)
+ (print-usage)
+ (exit #f)))
+ args)))))
;; tissue is an alias for `tissue search'
((_)
(main "tissue" "search"))))