blob: 31030a262de183a85f76db528ad55f4679cb8e12 (
plain)
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
|
#!/bin/bash
BASE=/srv/repositories
umask 022
# silence pushd/popd
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
for repo in $(find $BASE -type d -name "*.git" | grep -v /people/);
do
pushd $repo
# the gc.log is a copy of the stderr created by a backgrounded
# gc process. It will block further git operations until removed
# but we need a chance to at least look at what it's complaining
# about first.
if [ -f gc.log ];
then
echo "WARNING: found ${repo}/gc.log"
cat ${repo}/gc.log
rm -f ${repo}/gc.log
fi
# check for dangling commits and orphans
if [ ! -z "$(git fsck --connectivity-only --no-progress)" ];
then
# this causes dangling refs to expire now and prunes
# them from the object pack. It's expensive, however,
# because we end up repacking the object files.
git reflog expire --expire=now --all
ionice -c2 -n7 -- git gc --prune=now --aggressive >/dev/null
else
ionice -c2 -n7 -- git gc --auto > /dev/null
fi
done
|