1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/sh
## Copyright (C) 2006-2011 Daniel Baumann <daniel.baumann@progress-technologies.net>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
set -e
case "${1}" in
--quiet)
_QUIET="true"
shift
_GIT_REPACK_OPTIONS="-q"
_GIT_GC_OPTIONS="--quiet"
;;
esac
_REPOSITORIES="${@}"
if [ -z "${_REPOSITORIES}" ]
then
if [ ! -e HEAD ]
then
_REPOSITORIES="*.git"
else
_REPOSITORIES="$(pwd)"
fi
fi
for _REPOSITORY in ${_REPOSITORIES}
do
[ "${_QUIET}" ] || echo "--------------------------------------------------------------------------------"
[ "${_QUIET}" ] || echo ${_REPOSITORY}
[ "${_QUIET}" ] || echo "--------------------------------------------------------------------------------"
cd ${_REPOSITORY}
git repack ${_GIT_REPACK_OPTIONS} -a -d -F && git gc ${_GIT_GC_OPTIONS} --aggressive --prune
cd ..
if [ "$(id -u)" -eq "0" ]
then
_UID="$(stat -c %u ${_REPOSITORY})"
_GID="$(stat -c %g ${_REPOSITORY})"
chown ${_UID}:${_GID} ${_REPOSITORY} -R
fi
done
|