1 #!/bin/sh 2 3 [ -z "$1" ] && echo "ERROR: repo name not provided" && exit 1 4 5 repo_folder="$1" 6 name="$(basename $repo_folder)" 7 repo_bare_path="$repo_folder/$name.git" 8 9 echo "updating '$repo_folder' git frontend" 10 echo "cache file: '$repo_folder/.cache'" 11 12 ( 13 cd "$repo_folder"; 14 stagit "$repo_bare_path" -c .cache; 15 ln -sf files.html index.html; 16 ln -sf ../style.css style.css; 17 ln -sf ../logo.png logo.png; 18 ln -sf ../favicon.png favicon.png; 19 ) 20 21 # echo "updateing \`git.kloeckner.com.ar\` main index" 22 23 # generate index 24 # stagit-index $(find "$git_folder" -mindepth 1 -maxdepth 2 -name '*.git' \ 25 # -type d -printf '%P\n' | sort) > "$git_folder"/index.html 26 27 # stagit-index $(find "$git_folder" -mindepth 1 -maxdepth 2 -name '*.git' \ 28 # -type d -printf '%P\n' | sort) > index.html 29 30 # append git files to .gitignore 31 # ignore symlinks 32 # find . -type l | sed -e s'/^\.\///g' >> .gitignore 33 34 # for repo in $(find "$git_folder" -mindepth 1 -maxdepth 1 -type d -printf '%f\n');\ 35 # do 36 # (cd "$repo"; stagit "$repo".git \ 37 # -c .cache; 38 # ln -sf files.html index.html; 39 # ln -sf ../style.css style.css 40 # ln -sf ../logo.png logo.png 41 # ln -sf ../favicon.png favicon.png 42 # ) 43 # done 44 45 # detect git push -f 46 # force=0 47 # while read -r old new ref; do 48 # test "${old}" = "0000000000000000000000000000000000000000" && continue 49 # test "${new}" = "0000000000000000000000000000000000000000" && continue 50 # 51 # hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) 52 # if test -n "${hasrevs}"; then 53 # force=1 54 # break 55 # fi 56 # done 57 # 58 # echo "forced pushed detected" 59 60 # link repos to git home (makes url prettier) 61 # for repo in $(find repos -name *.git); do ln -sf $repo /home/git; done
