From 626a84a76e27335b2609ecc1300fb7706b65b98e Mon Sep 17 00:00:00 2001 From: pho4cexa Date: Fri, 9 Dec 2022 08:00:07 -0800 Subject: [PATCH] check file existence in source-files-list not cwd added source-files-list to populate-html-template. kindof dislike having so many variables passed to a function but i also kindof dislike global variables; not sure how to make this prettier yet. but this solves the bug i introduced in my last commit where the nav links were broken when used as a githook. --- README.md | 3 +++ main.scm | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 525cf2b..6213687 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ Assuming the current directory is a Git repository, this command populates *DESTINATION* with HTML files that provide a web-browsable view of the contents of the git repository. +Note: changes must be at least committed before they will appear in the HTML output. +More precisely: the HTML output represents the state of the HEAD commit, not that of the current work-tree (if any). + You may also cause this directory to be automatically updated upon every `git push`, by invoking *repo2html* as a Git *post-receive hook*. ## features diff --git a/main.scm b/main.scm index 3baf4ae..fd2b48b 100755 --- a/main.scm +++ b/main.scm @@ -19,7 +19,7 @@ (define DESCRIPTION (or (get-environment-variable "REPO2HTML_DESCRIPTION") "my git repositories")) (define H1 (or (get-environment-variable "REPO2HTML_H1") "git.example.com")) -(define (populate-html-template repository-name source-file display-body-thunk) +(define (populate-html-template repository-name source-files-list source-file display-body-thunk) (define-values (source-directory source-filename source-extension) (decompose-pathname source-file)) (define-values (base-origin base-directory directory-elements) @@ -75,14 +75,14 @@ hr {

#{repository-name}

clone url: #{CLONE-URL}/#{repository-name}

@@ -181,7 +181,7 @@ string-block (when destination-directory (create-directory (make-pathname html-repo-path destination-directory) #t))) (with-output-to-file (make-pathname html-repo-path filename) - (lambda () (populate-html-template repository-name filename display-body-thunk)))) + (lambda () (populate-html-template repository-name source-files-list filename display-body-thunk)))) (create-directory html-repo-path #t) ;; special files