files/update-gitweb-access-list
4e5efbc7
 #!/bin/sh
 set -euC
 
 # This does the same thing (in fact uses) the built in version except that it
 # does not include the `.git` suffixes.
 
 # Run the built-in version.
 "$GL_BINDIR/triggers/post-compile/update-gitweb-access-list"
 
 # Clear previous links.
 find "$GL_REPO_BASE" -name '*.git' -prune -o -type l -exec rm {} +
 # Create new links.
 gitolite list-phy-repos \
 | while IFS= read -r repo
 do
     mkdir -p "$(dirname "$GL_REPO_BASE/$repo")"
     ln -s \
         "$GL_REPO_BASE/$repo.git" \
         "$GL_REPO_BASE/$repo"
 done
 
 # Determine projects list file.
 projects_list="$(
     gitolite query-rc GITWEB_PROJECTS_LIST ||
     echo "$HOME/projects.list"
 )"
 # Process and write.
 if [ -r "$projects_list" ]
 then
     tmp="$(mktemp)"
     < "$projects_list" sed 's/\.git$//' >| "$tmp"
     < "$tmp" cat >| "$projects_list"
     rm "$tmp"
 fi