commit 7c403af5361bcc7e9c62b6d8e367e9ca2050ca71
parent fba469114156b480750b1bdea57b0db50e7d4ce4
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Tue, 16 Dec 2025 23:53:32 +0100
Fix bloopers
Hadn't realized 'git init --bare' would always spawn a 'description'.
Give up on checking then; let user sort this out a posteriori; also
make symlink clobber www's 'description'.
Got confused between "WWW_DIR" (HTTP server root) vs "directory for
the 'www' remote". Oops.
Also, who knew setting a variable named 'GIT_DIR' could influence git
commands, and in particular setting it to point to a non-repo
directory completely broke those git commands. I'm shocked.
Diffstat:
4 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/git/.gitignore b/git/.gitignore
@@ -0,0 +1 @@
+settings
diff --git a/git/add-repo.sh b/git/add-repo.sh
@@ -23,18 +23,13 @@ declare -r REPO_DESCRIPTION="${REPO_DIR}"/description
declare -r REPO_OWNER=$(repo-owner)
declare -r REPO_URL=https://${DOMAIN}/${REPO_NAME}
-test -f "${REPO_DESCRIPTION}" || {
- echo >&2 "Missing 'description' 🙅"
- exit 1
-}
-
(
cd "${WWW_DIR}"
git init --bare "${REPO_NAME}"
cd "${REPO_NAME}"
ln -s ../*.{css,png} .
- ln -s "${REPO_DESCRIPTION}" .
+ ln -sf "${REPO_DESCRIPTION}" .
echo "${REPO_OWNER}" > owner
echo "${REPO_URL}" > url
)
diff --git a/git/post-receive b/git/post-receive
@@ -6,11 +6,13 @@ declare -r SCRIPTS_DIR=$(dirname "$(realpath "$0")")
. "${SCRIPTS_DIR}"/settings
. "${SCRIPTS_DIR}"/tools.env
+declare -r WWW_REPO_DIR=$(git remote get-url www)
+
v () {( set -x ; "$@" )}
v git push --all --force www
-cd "${WWW_DIR}"
+cd "${WWW_REPO_DIR}"
v git update-server-info
v stagit "${PWD}"
diff --git a/git/settings.sample b/git/settings.sample
@@ -1,6 +1,5 @@
# Hey Emacs! -*- shell-script -*- please.
-declare -r GIT_DIR=~/git
-declare -r TOOLS_DIR=${GIT_DIR}/.tools
+declare -r TOOLS_DIR=~/git/.tools
declare -r DOMAIN=git.${USER}.uber.space
declare -r WWW_DIR=/var/www/virtual/${USER}/${DOMAIN}