From 2562403d13daaabb1c6eb324b2c34b0c17e1656b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 3 Jul 2022 01:44:50 +0530 Subject: tissue: Read files from git repository, not from the working tree. This also frees us from checking if the file actually exists in the working tree. * bin/tissue (tissue-show): Use call-with-file-in-git instead of call-with-input-file. (load-config): Use call-with-file-in-git and eval-string instead of load. * tissue/document.scm: Import (tissue git). (document-text, read-gemtext-document): Use call-with-file-in-git instead of call-with-input-file. * tissue/issue.scm (file-details): Read from a port instead of from a file. (read-gemtext-issue): Call file-details with a port reading the file committed into the git repository. * tissue/web/server.scm: Import (tissue git). * tissue/web/static.scm (exporter): Use call-with-file-in-git instead of call-with-input-file. --- tissue/document.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tissue/document.scm') diff --git a/tissue/document.scm b/tissue/document.scm index 1ee55cf..e46e055 100644 --- a/tissue/document.scm +++ b/tissue/document.scm @@ -28,6 +28,7 @@ #:use-module (oop goops) #:use-module (term ansi-color) #:use-module (xapian xapian) + #:use-module (tissue git) #:use-module (tissue utils) #:export (slot-set object->scm @@ -163,7 +164,7 @@ and further text, increase-termpos! must be called before indexing." (define-method (document-text (document )) "Return the full text of DOCUMENT." - (call-with-input-file (file-document-path document) + (call-with-file-in-git (current-git-repository) (file-document-path document) get-string-all)) (define-method (document-term-generator (document )) @@ -255,7 +256,7 @@ a list of search results." (define (read-gemtext-document file) "Reade gemtext document from FILE. Return a object." (make - #:title (or (call-with-input-file file + #:title (or (call-with-file-in-git (current-git-repository) file (lambda (port) (port-transduce (tfilter-map (lambda (line) ;; The first level one -- cgit v1.2.3