Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: brian (git@myr.sh)
Date: Fri Sep 29 16:27:30 2023 -0300
Parent: 4f47ee2
Added refs update script
diff --git a/post-receive b/post-receive index 7b2db64..04f73be 100755 --- a/post-receive +++ b/post-receive @@ -15,6 +15,9 @@ git clone . "$OUT/$REPO/tree" # update repo's index page . ./hooks/update-repo-index +# update repo's refs page +. ./hooks/update-repo-refs + # update repo's tree page . ./hooks/update-repo-tree diff --git a/post-receive-scripts b/post-receive-scripts index 650c355..43a0a8b 100755 --- a/post-receive-scripts +++ b/post-receive-scripts @@ -25,6 +25,7 @@ do cp "$TMP/post-receive" "$dir/hooks/" cp "$TMP/update-git-index" "$dir/hooks/" cp "$TMP/update-repo-index" "$dir/hooks/" + cp "$TMP/update-repo-refs" "$dir/hooks/" cp "$TMP/update-repo-tree" "$dir/hooks/" cp "$TMP/update-repo-log" "$dir/hooks/" cp "$TMP/aux.sh" "$dir/hooks/" @@ -40,6 +41,8 @@ done . ./hooks/update-git-index . ./hooks/update-repo-index +. ./hooks/update-repo-refs + . ./hooks/update-repo-tree . ./hooks/update-repo-log diff --git a/update-repo-refs b/update-repo-refs new file mode 100755 index 0000000..1d2bb04 --- /dev/null +++ b/update-repo-refs @@ -0,0 +1,37 @@ +#!/bin/sh + +# for debugging +# set -ex +echo "updating repo refs" + +. ./hooks/aux.sh + +OUT="$HOME/www/dovel.email/$REPO" + +echo "creating refs.html" +cat << EOF > "$OUT/refs.html" + $(pagehead "$REPO") + $(pagesummary) + <hr> + <h2>Branches</h2> + <table> +EOF + +git show-ref --heads | while read -r h n +do + echo "<tr><td>$h</td><td>$n</td></tr>" >> "$OUT/refs.html" +done + +echo "</table>\n<h2>Tags</h2>\n<table>" + +git show-ref --tags | while read -r h n +do + echo "<tr><td>$h</td><td>$n</td></tr>" >> "$OUT/refs.html" +done + +cat << EOF >> "$OUT/refs.html" +</table> +</body> +</html> +EOF +