git » homepage.git » commit 4ea4a27

add footer timestamp and sha link

author Alan Dipert
2025-10-08 04:31:23 UTC
committer Alan Dipert
2025-10-08 04:31:23 UTC
parent ce52bc2c8e1dcd917837029a5c36b3569992222f

add footer timestamp and sha link

Makefile +11 -8
README.md +1 -1

diff --git a/Makefile b/Makefile
index a64d929..6bae480 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ DEPLOY_HOST ?= arsien23i2@dreamhost:tailrecursion.com/~alan
 MD_FILES := $(shell find $(SRC) -type f -name '*.md' | LC_ALL=C sort)
 HTML := $(patsubst $(SRC)/%.md,$(OUT)/%.html,$(MD_FILES))
 
-all: check-git-clean $(OUT)/style.css $(HTML)
+all: $(OUT)/style.css $(HTML)
 
 $(OUT)/style.css: $(CSS)
 	@mkdir -p $(OUT)
@@ -43,19 +43,22 @@ $(OUT)/%.html: $(SRC)/%.md $(HEAD) $(FOOT) tools/mdlink2html.awk | $(OUT)
 		month=$$(date '+%B'); \
 		year=$$(date '+%Y'); \
 		time=$$(date '+%-I:%M%p %Z'); \
-		git_sha=$$(git rev-parse --short HEAD); \
-		build_info="Built by $$build_user@$$build_host on $$dow, $$month $$day$$suffix $$year at $$time (git $$git_sha)"; \
-		sed -e "s|@CSS@|$${css_prefix}|g" -e "s|@BUILDINFO@|$${build_info}|g" $(HEAD) > $@.head.html; \
-		sed -e "s|@CSS@|$${css_prefix}|g" -e "s|@BUILDINFO@|$${build_info}|g" $(FOOT) > $@.foot.html; \
+		git_sha_short=$$(git rev-parse --short HEAD); \
+		git_sha_full=$$(git rev-parse HEAD); \
+		repo_url="https://tailrecursion.com/git-arr/r/homepage.git/c/$${git_sha_full}/"; \
+		build_info="Built by $$build_user@$$build_host on $$dow, $$month $$day$$suffix $$year at $$time (git <a href=\"$${repo_url}\">$$git_sha_short</a>)"; \
+		build_info_esc=$$(printf '%s\n' "$$build_info" | sed 's/[\\/\&]/\\&/g'); \
+		sed -e "s|@CSS@|$${css_prefix}|g" -e "s|@BUILDINFO@|$${build_info_esc}|g" $(HEAD) > $@.head.html; \
+		sed -e "s|@CSS@|$${css_prefix}|g" -e "s|@BUILDINFO@|$${build_info_esc}|g" $(FOOT) > $@.foot.html; \
 		cat $@.head.html $@.body.html $@.foot.html > $@; \
 		rm -f $@.head.html $@.foot.html
 	@rm -f $@.rewritten.md $@.body.html
 
-assets: check-git-clean
+assets:
 	@mkdir -p $(OUT)
 	@rsync -a --include='*/' --exclude='*.md' --exclude='*.MD' --prune-empty-dirs $(SRC)/ $(OUT)/
 
-deploy: assets all
+deploy: check-git-clean assets all
 	@if [ -z "$(DEPLOY_HOST)" ]; then \
 		echo "DEPLOY_HOST is not set"; \
 		exit 1; \
@@ -76,7 +79,7 @@ help:
 	@echo '  make deploy   - rsync $(OUT)/ to $$DEPLOY_HOST'
 	@echo '  make tree     - count source and generated files'
 	@echo '  make clean    - remove $(OUT)/'
-	@echo '  (requires clean git worktree before building)'
+	@echo '  (deploy refuses to run with a dirty git worktree)'
 
 check-git-clean:
 	@if [ -n "$$(git status --porcelain)" ]; then \
diff --git a/README.md b/README.md
index 8d4fc09..516ab1d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ This converts Markdown from `md_export/` to HTML in `out/` and can deploy the re
 make assets && make
 xdg-open out/index.html  # or open on macOS
 
-> Note: builds require a clean git worktree. Commit or stash changes before running make.
+> Note: `make deploy` requires a clean git worktree. Commit or stash changes first if you plan to publish.
 
 ## Deploy
 make deploy  # uses rsync to upload to your shared host defined in DEPLOY_HOST