From 8fc064c7b07a249fb0e5cd1180d42629bf8dd32f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 23 Jan 2023 19:51:17 +0000 Subject: bin: Change to temporary clone before indexing. Indexing might refer to files on the filesystem. * bin/tissue (pull): Change to temporary clone of repository before indexing. --- bin/tissue | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/bin/tissue b/bin/tissue index 3dfc37b..4a2f37d 100755 --- a/bin/tissue +++ b/bin/tissue @@ -403,21 +403,23 @@ HOSTNAME." repository))))) (let ((config (load-config))) (parameterize ((%aliases (tissue-configuration-aliases config))) - ;; Index. - (let ((xapian-directory "xapian")) - (index xapian-directory) - (format (current-error-port) - "Indexed latest changes.~%")) - ;; Build website. - (let ((website-directory "website")) - (guard (c (else (format (current-error-port) - "Building website failed.~%") - (raise c))) - (call-with-temporary-directory - (lambda (temporary-output-directory) + (call-with-temporary-directory + (lambda (temporary-repository-clone) + (clone (git-top-level) temporary-repository-clone) + ;; Index. + (mkdir "xapian") + (let ((xapian-directory (canonicalize-path "xapian"))) + (call-with-current-directory temporary-repository-clone + (cut index xapian-directory)) + (format (current-error-port) + "Indexed latest changes.~%")) + ;; Build website. + (let ((website-directory "website")) + (guard (c (else (format (current-error-port) + "Building website failed.~%") + (raise c))) (call-with-temporary-directory - (lambda (temporary-repository-clone) - (clone (git-top-level) temporary-repository-clone) + (lambda (temporary-output-directory) (call-with-current-directory temporary-repository-clone (cut build-website temporary-output-directory @@ -425,9 +427,9 @@ HOSTNAME." (delete-file-recursively website-directory) (rename-file temporary-output-directory website-directory))) - (chmod website-directory #o755)))) - (format (current-error-port) - "Built website.~%"))))))))))) + (chmod website-directory #o755) + (format (current-error-port) + "Built website.~%")))))))))))))) (define tissue-pull (match-lambda* -- cgit v1.2.3