From: Ardis Lu Date: Wed, 24 Sep 2025 05:04:38 +0000 (-0700) Subject: Remove `$GIT_DIR` from post-update hook X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=04e8b53f9b47486872e9aaf417b28a05cc9ec50d;p=git.ardis.lu Remove `$GIT_DIR` from post-update hook `$GIT_DIR` is not set on the first push to a new repo. Instead, use the proper git command to avoid future issues. --- diff --git a/srv/git/git-shell-commands/init b/srv/git/git-shell-commands/init index ca962ce..a52cc56 100644 --- a/srv/git/git-shell-commands/init +++ b/srv/git/git-shell-commands/init @@ -46,13 +46,14 @@ git init --bare --quiet # Create post-update hook for dumb HTTP transport, generating README for summary view, # and general maintenance. -# See https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_dumb_http) +# See https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_dumb_http # See https://git-scm.com/docs/git-maintenance # See https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery +# Do not use $GIT_DIR, see https://stackoverflow.com/q/53121208/21084807 cat > "$path/hooks/post-update" << EOL #!/bin/sh git update-server-info -git cat-file blob HEAD:README.md | comrak --gfm > $GIT_DIR/README.html +git cat-file blob HEAD:README.md | comrak --gfm > "$(git rev-parse --git-common-dir)/README.html" git maintenance run EOL chmod a+x "$path/hooks/post-update"