2 # Mirror some Git repos
5 echo 'Usage: git-mirror [command] [arguments]
6 git-mirror run [path to repos] [path to log file] [html directory]
7 git-mirror gen-url [path to repo] -- generate url file in repo
8 git-mirror help -- show this message
10 relative paths are not supported, but globs are.
11 To use, first clone the wanted somewhere repos with the --mirror flag.'
15 [ -z ${3} ] && echo "not enough arguments" && exit 1
16 [ -z $(which stagit) ] && echo "please install stagit" && exit 1
20 [ -d ${3} ] || mkdir ${3}
21 stagit-index ./* > ${3}/index.html
22 cp /usr/share/doc/stagit/style.css ${3}
25 find ${1} -maxdepth 2 -name '*.git' | \
27 newdir=${3}/$(basename ${dir} .git)
28 [ -d ${newdir} ] || mkdir ${newdir}
31 cp /usr/share/doc/stagit/style.css .
32 git -C ${dir} fetch --tags
33 echo $(date -Iseconds) ' | ' ${dir} | tee -a ${2}
34 echo $(tail -n 1500 ${2}) > ${2}
41 find ${1} -maxdepth 2 -name '*.git' | \
43 git -C $dir remote get-url origin > $dir/url