#!/usr/bin/env bash # # GitTorrent Tracker repository update-hook -- GTP/0.1 # # This will be run when a reference in the repository changes. # set -x # Setup the state directory mkdir -p gittorrent touch gittorrent/refs # Create the reference list git ls-remote . > gittorrent/refs.list # Embedd it in a signed tag pointing to the last reference object cg tag -s -M gittorrent/refs.list gittorrent-refs $(cat gittorrent/refs) # Remove the symbolic reference from the repository mv refs/tags/gittorrent-refs gittorrent/refs # Move the new reference object into place refobj=$(cat gittorrent/refs) mv "objects/${refobj:0:2}/${refobj:2}" ../refs