diff options
-rw-r--r-- | tissue/web/static.scm | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/tissue/web/static.scm b/tissue/web/static.scm index fbef99e..795ccee 100644 --- a/tissue/web/static.scm +++ b/tissue/web/static.scm @@ -30,6 +30,7 @@ #:use-module (skribilo evaluator) #:use-module (skribilo reader) #:use-module (web uri) + #:use-module (git) #:use-module (tissue git) #:use-module (tissue issue) #:use-module (tissue utils) @@ -62,7 +63,7 @@ NEW-EXTENSION." @var{proc}. @var{proc} is passed two arguments---the input port to read from and the output port to write to." (lambda (out) - (call-with-file-in-git (current-git-repository) file + (call-with-input-file file (cut proc <> out)))) (define (copier file) @@ -132,16 +133,20 @@ the web output. Log to LOG-PORT. When LOG-PORT is #f, do not log." ;; Create output directory. (make-directories output-directory) - ;; Write each of the <file> objects. - (for-each (lambda (file) - (let ((output-file - (string-append output-directory "/" (file-name file)))) - (when log-port - (display (file-name file) log-port) - (newline log-port)) - (make-directories (dirname output-file)) - (call-with-output-file output-file - (lambda (port) - (call-with-current-directory repository-top-level - (cut (file-writer file) port)))))) - files)) + ;; Move into a temporary clone of the git repository, and write each + ;; of the <file> objects. + (call-with-temporary-directory + (lambda (temporary-repository-clone) + (clone repository-top-level temporary-repository-clone) + (for-each (lambda (file) + (let ((output-file + (string-append output-directory "/" (file-name file)))) + (when log-port + (display (file-name file) log-port) + (newline log-port)) + (make-directories (dirname output-file)) + (call-with-output-file output-file + (lambda (port) + (call-with-current-directory temporary-repository-clone + (cut (file-writer file) port)))))) + files)))) |